Linux Bash Shell
Cheat Sheet
(works with about every distribution, except for apt-get which is Ubuntu/Debian exclusive)
Legend:
Everything in “” is to be replaced, ex: --> iLovePeanuts.txt
Don't include the '=' in your commands
'..' means that more than one file can be affected with only one command ex: rm file.txt file2.txt movie.mov .. ..
Linux Bash Shell Cheat Sheet
Basic Commands
Basic Terminal Shortcuts
Basic file manipulation
CTRL L = Clear the terminal
CTRL D = Logout
SHIFT Page Up/Down = Go up/down the terminal
CTRL A = Cursor to start of line
CTRL E = Cursor the end of line
CTRL U = Delete left of the cursor
CTRL K = Delete right of the cursor
CTRL W = Delete word on the left
CTRL Y = Paste (after CTRL U,K or W)
TAB = auto completion of file or command
CTRL R = reverse search history
!! = repeat last command
cat = show content of file
(less, more) head = from the top
-n
CTRL Z = stops the current command (resume with fg in foreground or bg in background)
cp image.jpg newimage.jpg = copy and rename a file
Basic Terminal Navigation
cp cp cp cp image.jpg / = copy to folder image.jpg folder/sameImageNewName.jpg
-R stuff otherStuff = copy and rename a folder
*.txt stuff/ = copy all of * to folder
mv mv mv mv mv
file.txt Documents/ = move file to a folder = move folder in folder filename.txt filename2.txt = rename file stuff/newfileName
/ .. = move folder up in hierarchy
rm rm rm rm .. = delete file (s)
-i .. = ask for confirmation each file
-f = force deletion of a file
-r / = delete folder
ls ls ls ls ls
-a = list all files and folders = list files in folder
-lh = Detailed list, Human readable
-l *.jpg = list jpeg files only
-lh = Result for file only
cd = change directory if folder name has spaces use “ “ cd / = go to root cd .. = go up one folder, tip: ../../../ du -h: Disk usage of folders, human readable du -ah: