Terminal Reference Sheet
While browsing my stackedit markdown documents, I found a reference sheet for the linux terminal. While originally posted on novitiate, I thought that it might be of use to someone on this website too. The reference sheet was originally designed for the raspberry pi, but it works for other bash like shells too :)
You can find it below.
Basic Linux Terminal Reference Sheet
Command | Function |
---|---|
ls |
List the contents of the current directory |
cd orange |
Change the current directory to the sub-folder orange |
cd .. |
Change the current directory to the parent folder |
cd ~ |
Change the current directory to your home folder |
rm banana.txt |
Delete the file banana.txt |
rmdir pineapple |
Delete the directory pineapple , but only if it is empty |
rm -rf mango |
Delete the directory mango , even if it has files and folders inside it |
mkdir cheese |
Create a new folder called cheese |
mv kiwi.py cake.py |
Rename kiwi.py to cake.py |
cp bread.7z cherry.7z |
Copy bread.7z to cherry.7z |
mv cabbage oranges/tangerines |
Move the folder cabbage to the folder tangerines inside the folder oranges |
sudo command |
Execute command as the root (administrator) user |
sudo apt-get update |
Update the package list |
sudo apt-get upgrade |
Update the currently installed packages |
sudo apt-get install foo |
Install the package foo |
rpi-update |
Update the Raspberry Pi's firmware1 |
raspi-config |
Start the Raspberry Pi configuration utility |
nano apple.txt |
Edit the file apple.txt in the nano command line text editor |
exit |
Exit the terminal |
sudo shutdown -h now |
Shutdown |
sudo reboot |
Restart |
top |
View a list of processes using your CPU most intensively |
CTRL + C |
Keyboard shortcut to exit most programs |
CTRL + Z |
Keyboard shortcut to suspend the currently active process and return focus to the terminal |
fg |
Resume the currently suspended process |
jobs |
Display a list of jobs attached to the current terminal |
bg 2 |
Put the job with the id 2 into the background2 |
disown 2 |
Disown the job with the id 2 so that it will not be terminated when the terminal is terminated2 |
help | less |
Pipe the output of the command help into the command less , which lets you scroll through large amounts of output with the arrow keys (press q to quit). |
cat cakes.log | View the contents of cakes.log. Tip: add |
lessto pipe it into less` so that you can browse the file with the arrow keys. |
man less |
Display the manual page about the command less |
help less |
Display some basic help about the command less |
ssh pi@192.168.0.3 |
Connect to the device at the IP 192.168.0.3 with the username pi and start a remote terminal session |
Links to other useful lists
- http://www.techradar.com/news/computing/pc/how-to-get-to-grips-with-your-raspberry-pi-s-command-line-interface-1161712
- https://help.ubuntu.com/community/UsingTheTerminal
- http://ss64.com/bash/
- http://explainshell.com/
If you have any other commands or links to useful lists / references, please leave a comment below.
Have you found a cool bash reference? Post a comment below and I will consider adding it to the list.
-
This needs installing first. See this page: https://github.com/Hexxeh/rpi-update ↩
-
Note that to specify job #1, you type the command on it's own without the job id. ↩ ↩