Terminal cheat sheet
From Publication Station
CORE COMMANDS
cd [folder] | Change directory |
~/ | shortcut for your home directory. ~/Documents, ~/Downloads, ~/Desktop |
cd ~ | Change to Home directory, e.g. ‘cd ~/Documents/’ |
cd / | Root of drive |
‘cd ../’ = Move 1 level up | |
‘cd ../../’ = Move 2 levels up | |
ls | List files and folder inside current folder |
pwd | Full path to working directory |
cat [file] | print content (concatenate) of file to screen |
less [file] | read into content (concatenate) of file to screen |
rm [file] | Remove a file, e.g. rm [file] [file] |
rm -r [dir] | Remove a directory and contents |
cp [file] [newfile] | Copy file to file |
cp [file] [dir] | Copy file to directory |
mv [file] [new filename] | Move/Rename file or dirtory, e.g. mv -v [file] [dir] |
clear | Clear screen |
COMMAND HISTORY
history | Shows the stuff typed previously |
DIRECTORY MANAGEMENT
mkdir [dir] | Create new directory |
mkdir -p [dir]/[dir] | Create nested directories |
rmdir [dir] | Remove directory ( only operates on empty directories ) |
rm -R [dir] | Remove directory and contents |
PIPES - Allows to combine multiple commands that generate output
more | Output content delivered in screensize chunks |
> [file] | Push output to file, keep in mind it will get overwritten |
>> [file] | Append output to existing file |
< | Tell command to read content from a file |
HELP
man [command] | Show the manual for ‘command’ |
whatis [command] | Gives a one-line description of ‘command’ |
[command] -h | Offers help |
[command] —help | Offers help |
[command] help | Offers help |
reset | Resets the terminal display |
~