\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Mary F. Smith (boogie)} \pdfinfo{ /Title (linux-command-sheet.pdf) /Creator (Cheatography) /Author (Mary F. Smith (boogie)) /Subject (Linux Command Sheet Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{0740A3} \definecolor{LightBackground}{HTML}{EFF3F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Linux Command Sheet Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Mary F. Smith (boogie)} via \textcolor{DarkBackground}{\uline{cheatography.com/86236/cs/20137/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Mary F. Smith (boogie) \\ \uline{cheatography.com/boogie} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 15th May, 2025.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Information}} \tn % Row 0 \SetRowColor{LightBackground} pwd & | print working directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} cat & | print file {[}on screen{]} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\emph{user head or tail instead of cat}} & | shows the first few lines at beginning or end \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} hostname & | display hostname \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} -i {[}displays network address{]} -l {[}displays all local IPs{]}} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} date & | set/display date \& time \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{whois} \tn % Row Count 13 (+ 1) % Row 7 \SetRowColor{white} uptime & | display how long the system has been running \tn % Row Count 16 (+ 3) % Row 8 \SetRowColor{LightBackground} cal & | displays calendar \tn % Row Count 17 (+ 1) % Row 9 \SetRowColor{white} uname -a & | displays Linux system info \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} uname -r & | displays kernel info \tn % Row Count 21 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{lsb\_release -s} \tn % Row Count 22 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Manage Users}} \tn % Row 0 \SetRowColor{LightBackground} su - & | switch to root user \& move to that directory \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} adduser & | add new user \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} usermod -aG sudo {\emph{username}} & | add user to sudo list \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} groups {\emph{username}} & | list groups a user belongs too \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} su mfsmith & | switch to listed user mfsmith \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} passwd & | change password for current user name \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} passwd mfsmith & | change password for listed user \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \{\{ar\}\} passwd -S sysadmin & | displays the status of the users password \tn % Row Count 17 (+ 3) % Row 8 \SetRowColor{LightBackground} & {[}P{]} Unlocked \tn % Row Count 18 (+ 1) % Row 9 \SetRowColor{white} & {[}L{]} locked \tn % Row Count 19 (+ 1) % Row 10 \SetRowColor{LightBackground} & {[}NP{]} no password \tn % Row Count 20 (+ 1) % Row 11 \SetRowColor{white} adduser mfsmith -or- useradd mfsmith & | Creates a new user \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} usermod mfsmith & | modify username account \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} deluser mfsmith -or- userdel & | Deletes user \tn % Row Count 26 (+ 2) % Row 14 \SetRowColor{LightBackground} deluser mfsmith -{}-remove-all-files & | Deletes the user and removes all files in directory \tn % Row Count 29 (+ 3) % Row 15 \SetRowColor{white} getent powerusers | less & | print user groups \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Manage Users (cont)}} \tn % Row 16 \SetRowColor{LightBackground} usermod -l newusername oldusername & | change user name \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} sudo chfn mfsmith & | edit basic info i.e. full name, room \#, phone \# \tn % Row Count 5 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Process Management}} \tn % Row 0 \SetRowColor{LightBackground} ps & | displays users current processes \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ps -ef & | displays all processes \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} pmap & | displays memory usage \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} pstree & | display in a tree \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} ps -ef | grep wa & | display all info reference this process \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} ps kill 84679 & | kill process id 84679 \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} ps killall java & | kill all processes named java \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} top & | show all running proicesses \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.68 cm} x{6.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Disk/Hardware Mgmt}} \tn % Row 0 \SetRowColor{LightBackground} df -h & | disk usage \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ps & | running processes \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{System Monitoring}} \tn % Row 0 \SetRowColor{LightBackground} whoami & | display user \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} uptime & | system run time \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} cat \seqsplit{/proc/cpuinfo} & | \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} free -h & | display free memory\} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} lshw & | print hardware configuration \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} last reboot & | disaply date \& time of last reboot \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} w & | display currently logged in users \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.84 cm} x{4.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{General Maintenance}} \tn % Row 0 \SetRowColor{LightBackground} Shutdown \textasciicircum{}{\emph{{[}OPTIONS{]} TIME {[}MESSAGE{]}}}\textasciicircum{} & | sudo shutdown =1 "System scheduled for restart" \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{Update \& Upgrade the Debian OS} \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} & sudo apt-get update \&\& sudo apt-get upgrade \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.36 cm} x{4.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Package management | OS Maintenance}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt-get update & | check for updates in current version \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{apt-get updater \&\& apt-get upgrade} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 3 (+ 0) % Row 3 \SetRowColor{white} \{\{ar\}\}apt-cache search docker & | search for packages with the word "Docker" in the file name \tn % Row Count 6 (+ 3) % Row 4 \SetRowColor{LightBackground} apt-get install docker & | install docker \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 8 (+ 0) % Row 6 \SetRowColor{LightBackground} apt-get remove & | removes a package \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} apt-get purge & | removes and deletes \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Misc Need Organizing}} \tn % Row 0 \SetRowColor{LightBackground} ssh mfsmith@srv-tower & log into machine \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{scp mfsmith@srv-tower :srv-dc} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} scp\textless{}username.@\textless{}host:{[}remote sourse{]} \textless{}local. & copies files from the host to the destination \tn % Row Count 6 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Working with Processes}} \tn % Row 0 \SetRowColor{LightBackground} pstree & | display a tree of processes \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} systemctl processname & | control the systemd init system \& service manager \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.2 cm} x{6.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SuperUser}} \tn % Row 0 \SetRowColor{LightBackground} su - & | change to superuser \& stay at root directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sudo - & | execute a command as root \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{- or -} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} sudo -u & | execute a command as a particular user \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Installs - Frequently Used}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{vagrant@debian11:/ {\bf{sudo apt-get install nano -y}}} \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Network Mgmt}} \tn % Row 0 \SetRowColor{LightBackground} iwconfig & | wireless interface \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ifconfig & | ethernetinterface \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\# The loopback network interface \newline auto lo \newline iface lo inet loopback \newline \newline \# The primary network interface \newline -auto enp0s3 \newline iface enp0s3 inet static \newline -address 192.168.1.97 \newline -netmask 255.255.255.0 \newline -gateway 192.168.1.1 \newline -dns-domain example.com \newline -dns-nameservers 1.1.1.1 \newline \newline {\bf{sudo systemctl restart networking}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.4 cm} x{5.6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Networking Command/Queries}} \tn % Row 0 \SetRowColor{LightBackground} ip a & | display IP Address, routing, devices and tunnels \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} netstat & | displays all active TCP connections, ports \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} {\bf{-nutlp {[}displays tcp/udp ports \& application running on port{]}}}} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} {\bf{-e {[}includes ethernet stats{]} -o {[}includes PIDs{]} -p {[}displays protocols{]} -r {[}displays routing table{]}}}} \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} ping & | test communication with machines \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} \{\{ar\}\} ping -c 4 & | limits the ping response to 4 replies \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} traceroute srv-dc & print packet route \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} host & | DNS lookup utililty \tn % Row Count 16 (+ 1) % Row 8 \SetRowColor{LightBackground} hostname & | show or set system name \tn % Row Count 17 (+ 1) % Row 9 \SetRowColor{white} iptables & |utililty for packet filtering and NAT \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} mtr & | network diagnostic tool \tn % Row Count 20 (+ 1) % Row 11 \SetRowColor{white} telnet & | access to the telnet tool \tn % Row Count 21 (+ 1) % Row 12 \SetRowColor{LightBackground} ufw & | application to mange filters and firewalls \tn % Row Count 23 (+ 2) % Row 13 \SetRowColor{white} mtr & | diagnostic tool \tn % Row Count 24 (+ 1) % Row 14 \SetRowColor{LightBackground} nbtstat & | displays netbios over tcp \tn % Row Count 25 (+ 1) % Row 15 \SetRowColor{white} arp & | displays caches apr table \tn % Row Count 26 (+ 1) % Row 16 \SetRowColor{LightBackground} pathping & | disaplys info about network latency/loss between hops \tn % Row Count 28 (+ 2) % Row 17 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{tcpdump} \tn % Row Count 29 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Other Commands}} \tn % Row 0 \SetRowColor{LightBackground} ; \textasciitilde{}{[}semi colon{]}\textasciitilde{} & | allows a user to stack/insert multiple command on one command line \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \&\& \textasciitilde{}{[}double ampersand{]}\textasciitilde{} & | if the command on the left is suceesful then run the command on the right \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} | | \textasciitilde{}{[}double pipe{]}\textasciitilde{} & based on the results of the first command, skip the second command \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.04 cm} x{6.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Directory Structure}} \tn % Row 0 \SetRowColor{LightBackground} / & | root directory of operating system \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} /etc & | host system config files \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} /var & | storage for file which grow in size \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} /bin & | user binary files i.e. cat, grep, etc. \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} /proc & | system processes \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} /srv & | system services \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} /mnt & | ppermenet storage \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} /home & | home directory for logged in user \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} /lib & | shared library files and kernel modules \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} /usr & | user utilities and apps \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} /dev & | device files i.e. mouse, keyboard, harddrive, etc. \tn % Row Count 17 (+ 2) % Row 11 \SetRowColor{white} /sbin & | system binary files \tn % Row Count 18 (+ 1) % Row 12 \SetRowColor{LightBackground} /opt & | option software \tn % Row Count 19 (+ 1) % Row 13 \SetRowColor{white} \seqsplit{/media} & | temp storage/flash drives \tn % Row Count 21 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Directory Colors}} \tn % Row 0 \SetRowColor{LightBackground} Blue | Directory & Yellow | Device \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Green | Executable & Magenta | Graphic Image \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Cyan | symbolic Link & Red | Archive File \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} & Red \& Black | Broken link \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{On many Linux distributions, directories may be displayed in blue, executable files may be displayed in green, and symbolic links may be displayed in cyan. \newline ‌⁠​​ \newline Colored output is not the default behavior for the ls command, but rather the effect of the -{}-color option. The ls seems to perform this coloring automatically because there is an alias for the ls command, so it runs with the -{}-color option.}} \newline \newline sysadmin@localhost:\textasciitilde{}\$ type ls \newline ls is aliased to `ls -{}-color=auto'} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.44 cm} x{6.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Working with Directories}} \tn % Row 0 \SetRowColor{LightBackground} ls & | list contents of current directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ls -r & | list files in subdirectories \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} ls -al & | list files with directories, size, permissions etc. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} ls-l & |list files and permissions \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} & r {[}read{]} w{[}write{]} x {[}execute{]} -= {[}no permissions \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} ls -a & | list contents of current directory including hidden files \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} ls -lart & | long, include hidden, {\bf{{\emph{, }}}} \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} ls -d*/ & | list directories \tn % Row Count 13 (+ 1) % Row 8 \SetRowColor{LightBackground} cd \textasciitilde{} & | jump to users home \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} cd.. & | jump to last directory \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} cd / & | jump to root home directory \tn % Row Count 16 (+ 1) % Row 11 \SetRowColor{white} cd - & | previous working directory \tn % Row Count 17 (+ 1) % Row 12 \SetRowColor{LightBackground} cd ../../ & | back up two levels \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Searching}} \tn % Row 0 \SetRowColor{LightBackground} locate {[}name of file{]} & | searches system \& locates that directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} find . -name {[}9414811\_49794.pdf{]} & | search in current directory for file name \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} find /home -name *.jpg & | search file type in listed directory \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\emph{Using GREP}} & | grep searches for patterns in files \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{grep -r} \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} command | grep & | searches the output of a command \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Searching \& Sorting}} \tn % Row 0 \SetRowColor{LightBackground} which \textasciitilde{}i.e. which ls\textasciitilde{} & | which command identifies the stored location of a command \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} type -a & | displays directory location of command \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} -t & | sort by time \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} -r & | sort by reverse order \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\}Regular Expressions} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} . & | Any one single character \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} {[} {]} & | Any one specified character \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} {[}\textasciicircum{} {]} & | Not the one specified character \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} * & | Zero or more of the previous character \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} \textasciicircum{} & | If first character in the pattern, then pattern must be at beginning of the line to match, otherwise just a literal \textasciicircum{} \tn % Row Count 20 (+ 5) % Row 10 \SetRowColor{LightBackground} \$ & | If last character in the pattern, then pattern must be at the end of the line to match, otherwise just a literal \$ \tn % Row Count 25 (+ 5) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\}Extended Expressions} \tn % Row Count 26 (+ 1) % Row 12 \SetRowColor{LightBackground} + & | One or more of the previous pattern \tn % Row Count 28 (+ 2) % Row 13 \SetRowColor{white} ? & | The preceding pattern is optional \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Searching \& Sorting (cont)}} \tn % Row 14 \SetRowColor{LightBackground} \{ \} & | Specify minimum, maximum or exact matches of the previous pattern \tn % Row Count 3 (+ 3) % Row 15 \SetRowColor{white} | & | Alternation - a logical "or" \tn % Row Count 5 (+ 2) % Row 16 \SetRowColor{LightBackground} ( ) & | Used to create groups \tn % Row Count 6 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} Anchor Characters} \tn % Row Count 7 (+ 1) % Row 18 \SetRowColor{LightBackground} 'search term' & | single quotes "protects" the word \tn % Row Count 9 (+ 2) % Row 19 \SetRowColor{white} '\textasciicircum{} search term' & | \textasciicircum{} means the first place \tn % Row Count 11 (+ 2) % Row 20 \SetRowColor{LightBackground} 'search term \$' & | \$ means the last place \tn % Row Count 13 (+ 2) % Row 21 \SetRowColor{white} {[} {]} & | {[} {]} match the blocked in character \tn % Row Count 15 (+ 2) % Row 22 \SetRowColor{LightBackground} . & | \tn % Row Count 16 (+ 1) % Row 23 \SetRowColor{white} * & | within a search, this character acts as a wildcard \tn % Row Count 18 (+ 2) % Row 24 \SetRowColor{LightBackground} ? & | in a search, this character indicates other letters/numbers \tn % Row Count 21 (+ 3) % Row 25 \SetRowColor{white} ! & | in a search, this character = does not \tn % Row Count 23 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{echo {[}D-P{]}{\emph{ \newline echo {[}!D-P{]}}} \newline \newline echo ?????{\emph{s \newline echo D}}n*s} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.76 cm} x{6.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Troubleshooting}} \tn % Row 0 \SetRowColor{LightBackground} Issue: & usermod command not found \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{Resolution:} & \{\{ar\}\} use su - instead of su root \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Issue: & wget command not found \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \seqsplit{Resolution:} & \{\{ar\}\} sudo apt-get install wget \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} Issue: & cannot access repositories \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \seqsplit{Resolution:} & manually add site via {\bf{nano /etc/apt/sources.list}} \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.2 cm} x{4.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Firewall}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt-get install ufw & | install firewall application \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sudo ufw allow 'Nginx HTTP' & | allow application to pass through firewall \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} sudo ufw status & | check firewall status \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} sudo ufw disable & | disable firewall \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} sudo ufw enable & | enable firewall \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} sudo ufw allow 22 & | allow port number to pass \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} sudo ufw reset & | reset firewall \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.16 cm} x{3.84 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Redirection}} \tn % Row 0 \SetRowColor{LightBackground} Redirect the output of a command & | add "\textgreater{}" \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{ar\}\} i.e. & cat food.txt \textgreater{} newfoodfile.txt \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} & | use "\textgreater{}\textgreater{}" to overwrite a file \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Fucnctions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Functions -} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{are typically utilized in scripting} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{are utilized to execute multiple commands} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{function\_name () \newline \{ \newline commands \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.36 cm} x{4.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Quotation Marks}} \tn % Row 0 \SetRowColor{LightBackground} There are {[}3{]} types of quotes & Section {[}5{]} Linus Essentials \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} " " | double quotes & tell the system to ignore special characters \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} ' ' | single quotes & the system does not consider it a variable \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \textbackslash{}` \textbackslash{}` | backwards quotes & the system interprests the word in single quotes as an execution \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 9 (+ 0) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{each of these marks tells the system the text inside the quotes are to be handled differently} \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}