\item[cat] List the contents of a file on \texttt{stdout}
\item[cat <file>] Create a new file
\item[cat file1 file2 > file3] Joins two files and stores the output as a new file
\item[cat <file.txt> | tr a-z A-Z output.txt] Convert a file to upper or lower case
\item[diff] Compare the contents of two files line by line
\item[rm] Delete (permanently) a file
\item[cp] Copy files
\item[cp file1 file2] Copy the contents of the first file to the second one
\item[cp -r <directorya> <directory2>] Copy recursively the contents of the first directory into the second directory.
\item[mv] Move or rename files
\item[mv file1 file2] Rename a file
\item[ln -s <path/to/file> <link name>] Create a symbolic link to a file
\item[touch <newfile>] Create a new file
\item[touch <oldfile>] Update the modification time of an existing file
\item[more <file>] Show the contents of a file
\item[head <file>] Show the first 10 lines of a file
\item[head -<n> <file>] Show the first \texttt{n} lines of a file
\item[tail <file>] Show the last 10 lines of a file
\item[tail -<n> <file>] Show the last \texttt{n} lines of a file
\item[locate] Search for a file or directory
\item[find] Locate files within a directory
\end{description}
\section*{Directories}
\begin{description}
\item[cd] Change the current directory
\item[cd..] Move one directory up
\item[cd-] Move to your previous directory
\item[pwd] Show the current directory (relative to \texttt{\$HOME})
\item[scp <file> <server/file>] Securely copy a specific file to a server directory
\item[mkdir] Create a new directory
\item[rmdir] Delete an empty directory
\item[rsyng -a </path/to/file> </file>] Synchronize the contents of a specific direcotry with a backup directory
\item[rm -r <directory>] Remove a non-empty directory
\item[rm -ri <directory>] Remove a non-empty directory recursively, and require confirmation of each item
\end{description}
\section*{Archives}
\begin{description}
\item[tar]Archive multiple files into a common Linux file format (\textbf{Note:}\texttt{tar} files are \textit{not} compressed.)
\item[tar -xf file.tar] Extract an archived file
\item[tar -cf file.tar file1.txt file2.txt] Create an archive from one or more files
\item[tar -czf file.txt file.tar.gz] Create a gzip-compressed file (\textbf{Note:} the file extensions \texttt{.tar.gz} and \texttt{.tgz} are equivalent.)
\item[gzip file] Compress a file with the \texttt{.gz} extension
\item[gpg -c <file>] Encrypt a file
\item[gpg <file>] Decrypt a file
\item[zip <archive.zip> <file1> <file2>] Compress files into a zip archive
\item[unzip <archive.zip>] Extract zipped files from a zip archive
\item[hostname] Display the name of your host or network
\item[ip addr show] Show IP addresses and network interfaces
\item[ping] Check connectivity to a server
\item[ifconfig] Show IP addresses of all network interfaces
\item[netstat -pnltu] Show active ports
\item[netstat -nutlp] Show more information about a domain
\item[whois <domain>] Show more information about a domain
\item[dig <domain>] Show DNS information about a domain
\item[host <domain>] Do an IP lookup for a domain
\item[hostname -i] Show the IP address of the system
\end{description}
\section*{Users, Groups, and Permissions}
\begin{description}
\item[id] Show information about the current user
\item[useradd] Create a new user
\item[passwrd] Add a password to a user's account
\item[last] Show last logins
\item[userdel <user>] Delete a user
\item[chmod] Change the read, write, and execute permissions of files and directories
\item[chmod u + x <file>] Give the user execute permissions on a file
\item[chmod u+rw,go+r <file>] Give read and write permissions to the owner, and read-only permissions to the group and others.
\item[chmod -R 755 <directory>] Change the permissions of a directory and its files recursively
\item[chown] Change or transfer file ownership
\item[chown <user> <file>] Change the ownership of a file to a given user
\item[chown :<group> <file>] Change the group of a file to a given group (\textbf{Note:} Instead of the group permissions, the user permissions will apply if the owner user is in this group.)
\item[sudo] Perform tasks as the root user
\end{description}
Permissions are always in the order: owner, group, others.
\hspace{1em} Calculate permission digits by adding these numbers:
\begin{itemize}[noitemsep]
\item 4 — read (r)
\item 2 — write (w)
\item 1 — execute (x)
\end{itemize}
\section*{Pipes and Redirection}
\begin{description}
\item[cmd1 | cmd2] Pipe the \texttt{stdout} of the first command to the second command
\item[cmd1 |\& cmd2] Pipe the \texttt{stderr} of the first command to the second command
\item[cmd1 > file.txt] Redirect the \texttt{stdout} of a command to a file
\item[cmd1 2>error.log] Redirect the \texttt{stderr} of a commmand to a log file