DIRECTORIES
Display path of current working directory
pwd
Change directory to _directory_
cd <directory>
Navigate to parent directory
cd ..
List detailed directory contents, including hidden files
ls -la
Create new directory named _directory_
mkdir <directory>
OUTPUT
Output the contents of _file_
cat <file>
Output the contents of _file_ using the less command (which supports pagination etc.)
less <file>
Output the first 10 lines of _file_
head <file>
Direct the output _cmd_ of into _file_
<cmd> > <file>
Append the output of _cmd_ to _file_
<cmd> >> <file>
Direct the output of _cmd_ to _file_
<cmd1> | <cmd2>
Clear the command line window
clear
FILES
Delete _file_
rm <file>
Delete _directory_
rm -r <directory>
Force-delete _file_ (add -r to force-delete a directory)
rm -f <file>
Rename _file-old_ to _file-new_
mv <file-old> <file-new>
Move _file_ to _directory_ (possibly overwriting an existing file)
mv <file> <directory>
Copy _file_ to _directory_ (possibly overwriting an existing file)
cp <file> <directory>
Copy _directory1_ and _directory2_ its contents to (possibly overwriting files in an existing directory)
cp -r <directory1> <directory2>
Update file access & modification time (and create _file_ if it doesn’t exist)
touch <file>
PERMISSIONS
Change permissions of _file_ to 755
chmod 755 <file>
Change permissions of _directory_ (and its contents) to 600
chmod -R 600 <directory>
Change ownership of _file_ to _user_ and _group_ (add -R to include a directory’s contents)
chown <user>:<group> <file>
SEARCH
Find all files named _file_ inside _dir_ (use wildcards [*] to search for parts of filenames, e.g. “file.*”)
find <dir> -name "<file>"
Output all occurrences of _text_ inside _file_ (add -i for case-insensitivity)
grep "<text>" <file>
Search for all files containing _text_ inside _dir_
grep -rl "<text>" <dir>
NETWORK
Ping _host_ and display status
ping <host>
Output whois information for _domain_
whois <domain>
Download _file_ (via HTTP[S] or FTP)
curl -O <url/to/file>
Establish an SSH connection to _host_ with user
ssh <username>@<host>
Copy _file_ to a remote _host_
scp <file> <user>@<host>:/remote/path
PROCESS
Output currently running processes
ps ax
Display live information about currently running processes
top
Quit process with ID _pid_
kill <pid>