DEV Community

Mubasshir Ahmed
Mubasshir Ahmed

Posted on

Shell Scripting CheatSheet

echo hello : to print anything.
echo $PATH: to show all the paths in my machine.
which echo:
pwd: present working directory. it will show my current directory.
ls -l : will print folder structure with additional info.
mv test new_test : rename test folder to new_test
cp test.csv new_test : it will copy test.csv to new_test directory cp ${selected file or directory}${directory name where file will be moved}
rm full_doc_test.csv : to remove a file
rmdir test : to remove empty directory
man ls : it will show the manual about ls.
ctrl+l : to clear terminal
echo hello > hello.txt : it will create a txt file and write hello on it .
cat hello.txt : it will print the content of file .
cat < hello.txt : it will open hello.txt, and takes its content as input of cat. and cat will show it's output.
cat < hello.txt > hello2.txt : it will open hello.txt, and takes its content as input of cat and then wrtie input to hello2.txt
ls -l / | tail -n1: tail-n1 print last line . | this name is pipe . pipe takes the outpur of the program to the left and make it input to program is in right . ls-lshow folder structure and pipe takes it's output and make it as input of tail -n1 . pipe wires left side program to right side program .
curl : a command line tool that enables data exchange between a device and a server through a terminal
curl - head - silent google.com

Image description

cd /sys showing kernal parameter

Image description

cd /class-> it will show devices directory that machine can interact with from where I can modify device like pc brightness etc .

Image description

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post