\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{ivese} \pdfinfo{ /Title (sys-admin.pdf) /Creator (Cheatography) /Author (ivese) /Subject (SYS ADMIN 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}{520BA3} \definecolor{LightBackground}{HTML}{F4EFF9} \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{SYS ADMIN Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ivese} via \textcolor{DarkBackground}{\uline{cheatography.com/89700/cs/20418/}}} \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}ivese \\ \uline{cheatography.com/ivese} \\ \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 5th December, 2019.\\ 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*}{4} \begin{tabularx}{3.833cm}{p{0.44629 cm} x{2.98671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#1}} \tn % Row 0 \SetRowColor{LightBackground} grep & searches text files for lines that match \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} chmod & changes a user's permissions \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} chown & change the owner \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} pwd & shows the full path name of the current working directory \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} head & displays the start of a text file \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} tail & displays the end of a text file \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} cat & displays the full text file \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} find & Searches files based on user criteria \tn % Row Count 11 (+ 2) % Row 8 \SetRowColor{LightBackground} mkdir & creates a directory \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} mv & movies a file or directory from one location to another \tn % Row Count 14 (+ 2) % Row 10 \SetRowColor{LightBackground} cp & copies a file or directory \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} wget & retrieves content from a web server \tn % Row Count 17 (+ 2) % Row 12 \SetRowColor{LightBackground} \seqsplit{whoami} & shows username \tn % Row Count 19 (+ 2) % Row 13 \SetRowColor{white} man & show the man pages of commands \tn % Row Count 20 (+ 1) % Row 14 \SetRowColor{LightBackground} wc & counts the number of lines words and characters \tn % Row Count 22 (+ 2) % Row 15 \SetRowColor{white} du & checks disk usage \tn % Row Count 23 (+ 1) % Row 16 \SetRowColor{LightBackground} rm & removes objects \tn % Row Count 24 (+ 1) % Row 17 \SetRowColor{white} vi & screen oriented text editor \tn % Row Count 25 (+ 1) % Row 18 \SetRowColor{LightBackground} nano & screen oriented text editor \tn % Row Count 26 (+ 1) % Row 19 \SetRowColor{white} touch & create a file \tn % Row Count 27 (+ 1) % Row 20 \SetRowColor{LightBackground} gzip & compress/decompress a file \tn % Row Count 28 (+ 1) % Row 21 \SetRowColor{white} ssh & used to remote log into a host \tn % Row Count 29 (+ 1) % Row 22 \SetRowColor{LightBackground} sudo & gives temporary root permissions \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{p{0.44629 cm} x{2.98671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#1 (cont)}} \tn % Row 23 \SetRowColor{LightBackground} sort & lists files in a sorted order \tn % Row Count 1 (+ 1) % Row 24 \SetRowColor{white} rmdir & removes a directory \tn % Row Count 2 (+ 1) % Row 25 \SetRowColor{LightBackground} echo & moves data into a file \tn % Row Count 3 (+ 1) % Row 26 \SetRowColor{white} cd & change directory \tn % Row Count 4 (+ 1) % Row 27 \SetRowColor{LightBackground} ls & list the current directory \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.27021 cm} x{2.16279 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands \#2}} \tn % Row 0 \SetRowColor{LightBackground} ifconfig & used to change IP and net mask \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} which & finds the direct path of what you pass to it \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} groupadd & adds a user group \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} dnf install & used to install libraries/packages \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} adduser & adds user \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} systemctl & used to manage a systemd service. \seqsplit{(start/enable/restart/daemon-reload/etc)} \tn % Row Count 11 (+ 3) % Row 6 \SetRowColor{LightBackground} journalctl & used to view system logs for systemd \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} pip3 install & used to install python modules \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} source activate & used to activate a virtual environment \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} firewall-cmd & provides an interface to manage runtime and permanent firewall configuration. \tn % Row Count 21 (+ 4) % Row 10 \SetRowColor{LightBackground} history & used to look at your previously input commands \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{white} mount & mounts file/directory (redirects folder path to another location) \tn % Row Count 26 (+ 3) % Row 12 \SetRowColor{LightBackground} unmount & umounts file/directory \tn % Row Count 27 (+ 1) % Row 13 \SetRowColor{white} locate & finds files based of of a database \tn % Row Count 29 (+ 2) % Row 14 \SetRowColor{LightBackground} su & used to change the current user \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.27021 cm} x{2.16279 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands \#2 (cont)}} \tn % Row 15 \SetRowColor{LightBackground} .(followed by filename) & Any file that begins with a "." is hidden. "." also can be used to reference the current working directory \tn % Row Count 5 (+ 5) % Row 16 \SetRowColor{white} ping & test the reachability of a host on an Internet Protocol network \tn % Row Count 8 (+ 3) % Row 17 \SetRowColor{LightBackground} netstat & displays network connections for Transmission Control Protocol \tn % Row Count 11 (+ 3) % Row 18 \SetRowColor{white} kill(Ctrl + C) & used to stop a running process \tn % Row Count 13 (+ 2) % Row 19 \SetRowColor{LightBackground} traceroute & displays the route and measures transit delays of packets across an Internet Protocol network \tn % Row Count 17 (+ 4) % Row 20 \SetRowColor{white} \#!/bin/bash & used to denote a bash script \tn % Row Count 19 (+ 2) % Row 21 \SetRowColor{LightBackground} wget & retrieves content from web servers \tn % Row Count 21 (+ 2) % Row 22 \SetRowColor{white} scp & copies file from one host to another \tn % Row Count 23 (+ 2) % Row 23 \SetRowColor{LightBackground} exit & exits the current shell \tn % Row Count 24 (+ 1) % Row 24 \SetRowColor{white} clear & clears the terminal screen \tn % Row Count 26 (+ 2) % Row 25 \SetRowColor{LightBackground} ln & creates a symbolic link between two given arguments \tn % Row Count 29 (+ 3) % Row 26 \SetRowColor{white} xargs & executes commands from standard input \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.27021 cm} x{2.16279 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands \#2 (cont)}} \tn % Row 27 \SetRowColor{LightBackground} route & command used to view and manipulate the IP routing table \tn % Row Count 3 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.57918 cm} x{1.85382 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#3}} \tn % Row 0 \SetRowColor{LightBackground} {[}{[}...{]}{]} & used to test in a bash script. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} name= & used to assign a variable. \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} if /fi & marks the start and end of a if statement \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} elif & marks and else if statement in bash \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{Spaces in function calls represent different arguments} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} for ((i = 0 ; i \textless{} 100 ; i++)); & one example of a bash for loop \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \$\# & gets number of arguments \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \$* & gets all arguments \tn % Row Count 15 (+ 1) % Row 8 \SetRowColor{LightBackground} \$1 & gets the first argument \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} \$@ & gets all arguments starting from the first \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} for i in \{1..5\}; & python style for loop \tn % Row Count 20 (+ 1) % Row 11 \SetRowColor{white} do / done & denotes what to do during a for loop and the end of a loop \tn % Row Count 23 (+ 3) % Row 12 \SetRowColor{LightBackground} while loop & loops while something is true \tn % Row Count 25 (+ 2) % Row 13 \SetRowColor{white} until loop & loops while something is false \tn % Row Count 27 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{return followed by a number is used for error return status} \tn % Row Count 29 (+ 2) % Row 15 \SetRowColor{white} \$\{name\} & example of how to refer to a variable \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.57918 cm} x{1.85382 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#3 (cont)}} \tn % Row 16 \SetRowColor{LightBackground} "" & used to mark a section as a string \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} env & displays all environment variables \tn % Row Count 4 (+ 2) % Row 18 \SetRowColor{LightBackground} export & defines an environment variable \tn % Row Count 6 (+ 2) % Row 19 \SetRowColor{white} array=({[}0{]}=valA {[}1{]}=valB {[}2{]}=valC) & an example of how to instantiate an array \tn % Row Count 8 (+ 2) % Row 20 \SetRowColor{LightBackground} function name() \{commands\} & example of a bash functions \tn % Row Count 10 (+ 2) % Row 21 \SetRowColor{white} \&\& & and operator \tn % Row Count 11 (+ 1) % Row 22 \SetRowColor{LightBackground} || & or operator \tn % Row Count 12 (+ 1) % Row 23 \SetRowColor{white} == & checks if a string equals another \tn % Row Count 14 (+ 2) % Row 24 \SetRowColor{LightBackground} != & checks that string does not equal another \tn % Row Count 16 (+ 2) % Row 25 \SetRowColor{white} \textgreater{} & checks that string is greater than another \tn % Row Count 18 (+ 2) % Row 26 \SetRowColor{LightBackground} \textless{} & checks that string is less than another \tn % Row Count 20 (+ 2) % Row 27 \SetRowColor{white} -lt & less than for integers \tn % Row Count 22 (+ 2) % Row 28 \SetRowColor{LightBackground} -le & less than or equal for integers \tn % Row Count 24 (+ 2) % Row 29 \SetRowColor{white} -eq & equal for integers \tn % Row Count 25 (+ 1) % Row 30 \SetRowColor{LightBackground} -gt & greater than for integers \tn % Row Count 27 (+ 2) % Row 31 \SetRowColor{white} -ge & greater than or equal for integers \tn % Row Count 29 (+ 2) % Row 32 \SetRowColor{LightBackground} -ne & not equal for integers \tn % Row Count 31 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.6866 cm} x{2.7464 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#4}} \tn % Row 0 \SetRowColor{LightBackground} git clone & clones a local or remote repository \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} git commit & commits current contents of the index and the given log message describing the changes. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} git push & uploads local content to a remote repository \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} git status & gets the status of the git repository \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} df & shows disk usage \tn % Row Count 10 (+ 1) % Row 5 \SetRowColor{white} enable & enables and disables shell built-ins \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} -a file & file exists \tn % Row Count 13 (+ 1) % Row 7 \SetRowColor{white} -d file & file exists and is a directory \tn % Row Count 14 (+ 1) % Row 8 \SetRowColor{LightBackground} -e file & file exists; same -a \tn % Row Count 15 (+ 1) % Row 9 \SetRowColor{white} -f file & file exists and is a regular file \tn % Row Count 17 (+ 2) % Row 10 \SetRowColor{LightBackground} -r file & you have read permission \tn % Row Count 18 (+ 1) % Row 11 \SetRowColor{white} -s file & file exists and is not empty \tn % Row Count 19 (+ 1) % Row 12 \SetRowColor{LightBackground} -w file & you have write permission \tn % Row Count 20 (+ 1) % Row 13 \SetRowColor{white} -x file & you have execute permission on file \tn % Row Count 22 (+ 2) % Row 14 \SetRowColor{LightBackground} -N file & file was modified since it was last read \tn % Row Count 24 (+ 2) % Row 15 \SetRowColor{white} -O file & you own the file \tn % Row Count 25 (+ 1) % Row 16 \SetRowColor{LightBackground} -G file & file's group ID matches yours \tn % Row Count 26 (+ 1) % Row 17 \SetRowColor{white} yes & prints out an infinite loop with the given input \tn % Row Count 28 (+ 2) % Row 18 \SetRowColor{LightBackground} / & root directory \tn % Row Count 29 (+ 1) % Row 19 \SetRowColor{white} \seqsplit{hostname} & outputs the name of the current computer/server \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{p{0.6866 cm} x{2.7464 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Commands\#4 (cont)}} \tn % Row 20 \SetRowColor{LightBackground} write & sends a message to another user logged in to this computer \tn % Row Count 2 (+ 2) % Row 21 \SetRowColor{white} wall & broadcasts a message to all other users logged in to this computer \tn % Row Count 5 (+ 3) % Row 22 \SetRowColor{LightBackground} sleep & pause for a given number of seconds or ms \tn % Row Count 7 (+ 2) % Row 23 \SetRowColor{white} umask & change the default permissions given to newly created files \tn % Row Count 9 (+ 2) % Row 24 \SetRowColor{LightBackground} cal & outputs an ASCII calendar \tn % Row Count 10 (+ 1) % Row 25 \SetRowColor{white} date & outputs the current date/time \tn % Row Count 11 (+ 1) % Row 26 \SetRowColor{LightBackground} read & reads a value from standard input \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}