\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{Heisere} \pdfinfo{ /Title (system-admin-cs.pdf) /Creator (Cheatography) /Author (Heisere) /Subject (System Admin CS 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}{D5B4FA} \definecolor{LightBackground}{HTML}{F4ECFD} \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{System Admin CS Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Heisere} via \textcolor{DarkBackground}{\uline{cheatography.com/89610/cs/20395/}}} \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}Heisere \\ \uline{cheatography.com/heisere} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 13th February, 2020.\\ Updated 12th 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*}{3} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ERROR checking}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt update \&\& sudo apt upgrade -y & upgrades your machine with all tools completely \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} 0 & passes \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} any number other than 0 & is a fail error \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} test -d /tmp/temp\_dir test\_rc=\$? & check to see if directory was created \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} echo "mkdir resulted in \$\{mkdir\_rc\}, test resulted in \$\{test\_rc\}." & check return codes \tn % Row Count 12 (+ 4) % Row 5 \SetRowColor{white} true \&\& echo "We get here because the first part is true!" true || echo "We never see this because the first part is true :(" & Check out how an exit status of 0 affects the logical operators: \tn % Row Count 19 (+ 7) % Row 6 \SetRowColor{LightBackground} false \&\& echo "Since we only continue after \&\& with an exit status of 0, this is never printed." false || echo "Because we only continue after || with a return code that is not 0, we see this!" & Check out how an exit status of 1 affects the logical operators: \tn % Row Count 29 (+ 10) % Row 7 \SetRowColor{white} if {[}{[} \$\# -ne 3 {]}{]}; then echo "Incorrect usage!" echo "Usage: \$0 \textless{}directory\_name\textgreater{} \textless{}file\_name\textgreater{} \textless{}file\_content\textgreater{}" exit 1 fi & We need exactly three arguments, check how many have been passed to \# the script. \tn % Row Count 36 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ERROR checking (cont)}} \tn % Row 8 \SetRowColor{LightBackground} directory\_name=\$1 file\_name=\$2 file\_content=\$3 & Save the arguments into variables. \tn % Row Count 3 (+ 3) % Row 9 \SetRowColor{white} absolute\_file\_path=\$\{directory\_name\}/\$\{file\_name\} & create absolute path \tn % Row Count 6 (+ 3) % Row 10 \SetRowColor{LightBackground} if {[}{[} ! -d \$\{directory\_name\} {]}{]}; then mkdir \$\{directory\_name\} || \{ echo "Cannot create directory, exiting script!"; exit 1; \} fi & Check if the directory exists; otherwise, try to create it. \tn % Row Count 13 (+ 7) % Row 11 \SetRowColor{white} if {[}{[} ! -f \$\{absolute\_file\_path\} {]}{]}; then touch \$\{absolute\_file\_path\} || \{ echo "Cannot create file, exiting script!"; exit 1; \} fi & Try to create the file, if it does not exist. \tn % Row Count 20 (+ 7) % Row 12 \SetRowColor{LightBackground} echo \$\{file\_content\} \textgreater{} \$\{absolute\_file\_path\} & File has been created, echo the content to it. \tn % Row Count 23 (+ 3) % Row 13 \SetRowColor{white} cp /var/log/dpkg.log dpkg || \{ echo "Cannot copy dpkg.log to the new directory."; exit 1; \} & Copy the log file to our new directory. \tn % Row Count 28 (+ 5) % Row 14 \SetRowColor{LightBackground} cd \$(dirname \$0) & Change directory to the script location. \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ERROR checking (cont)}} \tn % Row 15 \SetRowColor{LightBackground} cp /var/log/dpkg.log dpkg || \{ echo "Cannot copy dpkg.log to the new directory."; exit 1; \} & Copy the log file to our new directory. \tn % Row Count 5 (+ 5) % Row 16 \SetRowColor{white} if {[}{[} \$\# -ne 1 {]}{]}; then echo "Incorrect usage!" echo "Usage: \$0 \textless{}file or directory path\textgreater{}" exit 1 fi & input validation \tn % Row Count 11 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.14011 cm} x{2.83689 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{git keeper}} \tn % Row 0 \SetRowColor{LightBackground} git clone \textless{}url\textgreater{} & copies url to directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} git add \textless{}file\textgreater{} & keep track of git file \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} git commit -am "done" & makes version of thing \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} git push & pushes version to git server \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{for loop}} \tn % Row 0 \SetRowColor{LightBackground} for word in \$\{words\}; do echo "The word is: \$\{word\}" done & for loop example \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} " " & bash keep spaces together also prevents asterisk from being expanded \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} ' ' & no variables will be replaced in single quotes plus what double quotes do \tn % Row Count 11 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Setting up Samba for file sharing}} \tn % Row 0 \SetRowColor{LightBackground} \$ sudo yum install samba samba-client samba-common & install samba \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \$ sudo cp /etc/samba/smb.conf \seqsplit{/etc/samba/smb.conf.backup} & backup at each stage \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \$ sudo mkdir /SharedFolder/ \$ sudo chmod -R 755 /SharedFolder/ & grant user permissions \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} \$ sudo firewall-cmd -{}-add-service=samba \$ sudo firewall-cmd -{}-reload & get past firewall \tn % Row Count 14 (+ 4) % Row 4 \SetRowColor{LightBackground} \$ sudo nano /etc/samba/smb.conf & configure samba file \tn % Row Count 16 (+ 2) % Row 5 \SetRowColor{white} \$ sudo smbpasswd –a \textless{}user\textgreater{} & create user \tn % Row Count 18 (+ 2) % Row 6 \SetRowColor{LightBackground} \$ sudo systemctl enable smb.service \$ sudo systemctl enable nmb.service \$ sudo systemctl start smb.service \$ sudo systemctl start nmb.service & start service \tn % Row Count 26 (+ 8) % Row 7 \SetRowColor{white} \$testparm -v & listing of all the Samba configuration options and the values to which they are currently set \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Setting up Samba for file sharing (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \$sudo smbpasswd -a \textless{}user\textgreater{} & set up password for user \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.93643 cm} x{2.04057 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ARRAYS}} \tn % Row 0 \SetRowColor{LightBackground} ARRAY=(hi "how are" you) & set values \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} echo \$\{ARRAY{[}*{]}\} & list variables in array \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} for x in "\$\{ARRAY{[}@{]}\}";do echo \$x; done & list variables in new lines \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} unset ARRAY{[}variable{]} & remove variable \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} ARRAY+=("bland" "hello") & add variables \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} echo \$\{\#ARRAY\} & get length of array \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} \$\{VAR:-WORD\} & substitute variable \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} "\$@" & shift variables \tn % Row Count 14 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{declare -A aa} \tn % Row Count 15 (+ 1) % Row 9 \SetRowColor{white} \$\{VAR/PATTERN/STRING\} & replace parts of a variable \tn % Row Count 17 (+ 2) % Row 10 \SetRowColor{LightBackground} \$\{VAR:OFFSET:LENGTH\} & remove substring \tn % Row Count 18 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.13091 cm} x{0.84609 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{general}} \tn % Row 0 \SetRowColor{LightBackground} lists the contents of files to the terminal window & cat \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} give your own name to a command or sequence of commands & alias \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} information and files from Uniform Resource Locators (URLs) or internet addresses & curl \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} shows the size, used space, and available space on the mounted filesystems of your computer & df \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} compares two text files and shows the differences between them & diff \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} close a terminal window & exit \tn % Row Count 13 (+ 1) % Row 6 \SetRowColor{LightBackground} gives you a short dump of information about a user, including the time of the user's last login, the user's home directory, and the user account's full name & \seqsplit{finger} \tn % Row Count 18 (+ 5) % Row 7 \SetRowColor{white} summary of the memory usage with your computer. & free \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} tells you which groups a user is a member of & \seqsplit{groups} \tn % Row Count 22 (+ 2) % Row 9 \SetRowColor{white} compresses files & gzip \tn % Row Count 23 (+ 1) % Row 10 \SetRowColor{LightBackground} gives you a listing of the first 10 lines of a file & head \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} terminate a process from the command line & kill \tn % Row Count 27 (+ 2) % Row 12 \SetRowColor{LightBackground} view files without opening an editor & less \tn % Row Count 29 (+ 2) % Row 13 \SetRowColor{white} verify that you have network connectivity with another network device & ping \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{4.13091 cm} x{0.84609 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{general (cont)}} \tn % Row 14 \SetRowColor{LightBackground} lists running processes & ps \tn % Row Count 1 (+ 1) % Row 15 \SetRowColor{white} shut down or reboot your Linux system & \seqsplit{shutdown} \tn % Row Count 3 (+ 2) % Row 16 \SetRowColor{LightBackground} listing of the last 10 lines of a file & tail \tn % Row Count 5 (+ 2) % Row 17 \SetRowColor{white} create an archive file & tar \tn % Row Count 6 (+ 1) % Row 18 \SetRowColor{LightBackground} real-time display of the data relating to your Linux machine. & top \tn % Row Count 8 (+ 2) % Row 19 \SetRowColor{white} obtain some system information regarding the Linux computer you're working on & uname \tn % Row Count 11 (+ 3) % Row 20 \SetRowColor{LightBackground} lists the currently logged in users. & w \tn % Row Count 13 (+ 2) % Row 21 \SetRowColor{white} find out who you are logged in as or who is logged into an unmanned Linux terminal. & \seqsplit{whoami} \tn % Row Count 16 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Add users}} \tn % Row 0 \SetRowColor{LightBackground} add user & sudo useradd \textless{}username\textgreater{} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} add user password & sudo smbpasswd -a \textless{}username\textgreater{} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Add Admin & sudo useradd -g wheel \textless{}lastnamefirstletter\textgreater{} \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Installing and setting up samba}} \tn % Row 0 \SetRowColor{LightBackground} check samba is not running & ps ax | egrep \seqsplit{"samba|smbd|nmbd|winbindd} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} delete any samba files that are already on the system & smbd -b | grep "CONFIGFILE" and smbd -b | egrep \seqsplit{"LOCKDIR|STATEDIR|CACHEDIR|PRIVATE\_DIR";} delete any files that these commands find \tn % Row Count 9 (+ 7) % Row 2 \SetRowColor{LightBackground} provision Samba AD. We'll want to do it interactively so our password can't be seen & samba-tool domain provision -{}-use-rfc2307 -{}-interactive \tn % Row Count 14 (+ 5) % Row 3 \SetRowColor{white} for the requests: & Realm: \seqsplit{SAP.CSLAB.MORAVIAN.EDU} Domain: SAP Server Role: dc DNS backend: SAMBA\_INTERNAL \tn % Row Count 19 (+ 5) % Row 4 \SetRowColor{LightBackground} Set your hostname to our domain: & hostname \seqsplit{sap.cslab.moravian.edu} hostname -b \seqsplit{sap.cslab.moravian.edu} \tn % Row Count 23 (+ 4) % Row 5 \SetRowColor{white} Now enable samba and make it sure it will run at boot: & sudo systemctl start samba sudo systemctl enable samba \tn % Row Count 26 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{virtual environments}} \tn % Row 0 \SetRowColor{LightBackground} python3 -m venv \seqsplit{/path/to/new/virtual/environment} & create new virtual environment \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} -h, -{}-help & man pages for environments \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} -{}-system-site-packages & Give the virtual environment access to the system site-packages dir. \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} -{}-symlinks & Try to use symlinks rather than copies, when symlinks are not the default for the platform. \tn % Row Count 14 (+ 5) % Row 4 \SetRowColor{LightBackground} -{}-copies & Try to use copies rather than symlinks, even when symlinks are the default for the platform. \tn % Row Count 19 (+ 5) % Row 5 \SetRowColor{white} -{}-clear & Delete the contents of the environment directory if it already exists, before environment creation. \tn % Row Count 24 (+ 5) % Row 6 \SetRowColor{LightBackground} -{}-upgrade & Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place. \tn % Row Count 30 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{virtual environments (cont)}} \tn % Row 7 \SetRowColor{LightBackground} -{}-without-pip & Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default) \tn % Row Count 5 (+ 5) % Row 8 \SetRowColor{white} -{}-prompt PROMPT & Provides an alternative prompt prefix for this environment. \tn % Row Count 8 (+ 3) % Row 9 \SetRowColor{LightBackground} \textless{}source\textgreater{} \textless{}dir\textgreater{}/bin/activate/ & activate virtual env \tn % Row Count 10 (+ 2) % Row 10 \SetRowColor{white} pip install \textless{}some project\textgreater{} & install a project \tn % Row Count 12 (+ 2) % Row 11 \SetRowColor{LightBackground} pip install -r requirements.txt & install required files \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Files and Directories}} \tn % Row 0 \SetRowColor{LightBackground} ls & to hide files \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ls -a & shows all files in current folder \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} ls .. & look in directory \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} ls ../.. -a & look in directory above \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} ls -a .. & look in hidden directory \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} ./ & run program from current folder \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} pwd & present working directory \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} tab & completes command \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} \textgreater{} & moves files somewhere else \tn % Row Count 13 (+ 2) % Row 9 \SetRowColor{white} rm \textasciitilde{}/\textless{}filename\textgreater{} & delete file \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} rm -r \textless{}dir\textgreater{} & delete directories \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} mk dir & create directories \tn % Row Count 16 (+ 1) % Row 12 \SetRowColor{LightBackground} wget \textless{}folder\textgreater{} & download folder \tn % Row Count 17 (+ 1) % Row 13 \SetRowColor{white} tar -xzf \textless{}folder\textgreater{}.tar.gz & unpack folder \tn % Row Count 19 (+ 2) % Row 14 \SetRowColor{LightBackground} cd \textless{}directory\textgreater{} & change directory \tn % Row Count 20 (+ 1) % Row 15 \SetRowColor{white} cd \textbackslash{} & go to home directory \tn % Row Count 21 (+ 1) % Row 16 \SetRowColor{LightBackground} mv & move \tn % Row Count 22 (+ 1) % Row 17 \SetRowColor{white} History | grep \textless{}command\textgreater{} & find commands with \textless{}command\textgreater{} in it \tn % Row Count 24 (+ 2) % Row 18 \SetRowColor{LightBackground} -f & to follow code to the end \tn % Row Count 26 (+ 2) % Row 19 \SetRowColor{white} -f -u \textless{}unit\textgreater{} & filter by the type of unit \tn % Row Count 28 (+ 2) % Row 20 \SetRowColor{LightBackground} !\textless{}number\textgreater{} & repeat command on line \tn % Row Count 29 (+ 1) % Row 21 \SetRowColor{white} script & everything that happened in a session \tn % Row Count 31 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ports an firewalls}} \tn % Row 0 \SetRowColor{LightBackground} firewall-cmd -{}-permanent -{}-add-port=\textless{}port\#\textgreater{}/tcp & add port \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} firewall-cmd -{}-reload & reboot port \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} firewall-cmd -{}-list-ports & list ports \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} firewall-cmd -{}-permanent -{}-add-service=http & use predefined service instead of port \# \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} sudo tcpdump -a -c 1000 & looks for the past 1000 connections within server \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} ifconfig & show local ip \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Network Diagnostic Tools}} \tn % Row 0 \SetRowColor{LightBackground} ping \textless{}webaddress\textgreater{} or \textless{}IP\textgreater{} & tracks the time the round trip took to server \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} ping -s \textless{}number\textgreater{} & try a packet of \textless{}number\textgreater{} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{/path/to/traceroot} \textless{}webaddress\textgreater{} & shows whether it can reach a host, but also the route it takes \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} dig & queries DNS servers and returns the information held about a particular domain. \tn % Row Count 12 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Set up SMB}} \tn % Row 0 \SetRowColor{LightBackground} go to file & sudo nano /etc/samba/smb.conf \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} input values & {[}homes{]} comment = Home Directories browsable = no writeable = yes valid users = sap.cslab.moravian.edu\textbackslash{}\%S {[}printers{]} comment = All Printers path = /var/spool/samba browsable = no guest ok = no writeable = no printable = yes \tn % Row Count 13 (+ 11) % Row 2 \SetRowColor{LightBackground} run & sudo setsebool -P \seqsplit{samba\_enable\_home\_dirs} on \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Set up DHCP}} \tn % Row 0 \SetRowColor{LightBackground} Setting up Static IP on Server (For DHCP) & ip addr add 192.168.114.1 dev br0; \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Setting up Bridging & sudo dnf install bridge-utils sudo brctl addbr br0 sudo brctl addif enp1s0 sudo brctl addif eno1 sudo ifconfig br0 up \tn % Row Count 9 (+ 6) % Row 2 \SetRowColor{LightBackground} DHCP Config & subnet 192.168.114.0 netmask 255.255.255.0 \{ range 192.168.114.1 192.168.114.255; option subnet-mask 255.255.255.0; option routers 192.168.114.1; option broadcast-address 192.168.114.255; default-lease-time 600; max-lease-time 7200; host interface0 \{ hardware ethernet 54:04:a6:3f:85:35; fixed-address 192.168.114.1; \} \} \tn % Row Count 26 (+ 17) % Row 3 \SetRowColor{white} DHCP Config pt.2 & \seqsplit{/etc/sysconfig/network-scripts/ifcfg-eno1:} \tn % Row Count 29 (+ 3) % Row 4 \SetRowColor{LightBackground} DHCP Config pt.3 & DEVICE=eno1 BOOTPROTO:dhcp TYPE: ethernet \seqsplit{ipaddr=192.168.114.1} ONBOOT=yes \tn % Row Count 33 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.84149 cm} x{3.13551 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Permissions and Owners}} \tn % Row 0 \SetRowColor{LightBackground} ls -l & view permissions of files and directories \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ./\textless{}filename\textgreater{} & execute file \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{chmod +x \textless{}filename\textgreater{}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} ls -l & added permission to execute file \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} chown bin & changes ownership of file(can only be used by root) \tn % Row Count 9 (+ 3) % Row 5 \SetRowColor{white} chgrp bin & changes group \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} chmod -x \textless{}filename\textgreater{} & removed permission to execute file \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} chmod u+x \textless{}filename\textgreater{} & assign execute permission to yourself only \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} chmod ug+rwx \textless{}filename\textgreater{} & assign read, write, execute permission to user and group \tn % Row Count 17 (+ 3) % Row 9 \SetRowColor{white} etc /shadow & can only be run by root \tn % Row Count 18 (+ 1) % Row 10 \SetRowColor{LightBackground} chmod -R & recursive \tn % Row Count 19 (+ 1) % Row 11 \SetRowColor{white} history & show all command history \tn % Row Count 20 (+ 1) % Row 12 \SetRowColor{LightBackground} adduser & adds user \tn % Row Count 21 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Cups printer}} \tn % Row 0 \SetRowColor{LightBackground} set up cups & lpadmin -p laserjet -L "Printer" -v \seqsplit{usb://HP/LaserJet\%202200}?serial=00USBGJ02797 \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} list the available backends and printers & lpinfo -v \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} The Bonjour (DNS-SD) protocol. & dnssd \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} The Internet Printing Protocol (IPP) with optional encryption. & ipp \tn % Row Count 12 (+ 4) % Row 4 \SetRowColor{LightBackground} The Internet Printing Protocol with mandatory encryption. & ipps \tn % Row Count 15 (+ 3) % Row 5 \SetRowColor{white} The Line Printer Daemon protocol & lpd: \tn % Row Count 17 (+ 2) % Row 6 \SetRowColor{LightBackground} The AppSocket (JetDirect) protocol. & socket \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} Set printer & lpadmin -p printername -v device-uri \tn % Row Count 21 (+ 2) % Row 8 \SetRowColor{LightBackground} aborts jobs. on printer & abort-job \tn % Row Count 23 (+ 2) % Row 9 \SetRowColor{white} Enables/disables per-printer sharing & -o \seqsplit{printer-is-shared=true/false} \tn % Row Count 25 (+ 2) % Row 10 \SetRowColor{LightBackground} Enables sharing of printers with other computers and mobile devices on your local network. & -{}-share-printers \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Cups printer (cont)}} \tn % Row 11 \SetRowColor{LightBackground} Expands printer sharing to any network that can reach your server. & -{}-remote-any \tn % Row Count 4 (+ 4) % Row 12 \SetRowColor{white} create, modify, or delete a class & lpadmin -p printername -c classname \tn % Row Count 6 (+ 2) % Row 13 \SetRowColor{LightBackground} printer is removed from the class & lpadmin -p printername -r classname \tn % Row Count 8 (+ 2) % Row 14 \SetRowColor{white} deletes the named class & lpadmin -x classname \tn % Row Count 10 (+ 2) % Row 15 \SetRowColor{LightBackground} enable debug logging & cupsctl -{}-debug-logging \tn % Row Count 12 (+ 2) % Row 16 \SetRowColor{white} disable debug logging & cupsctl -{}-no-debug-logging \tn % Row Count 14 (+ 2) % Row 17 \SetRowColor{LightBackground} creates a destination for a printer at IP address 11.22.33.44 & lpadmin -p printername -E -v \seqsplit{ipp://11.22.33.44/ipp/print} -m everywhere \tn % Row Count 18 (+ 4) % Row 18 \SetRowColor{white} creates a destination for a HP LaserJet printer at IP address 11.22.33.44 & lpadmin -p printername -E -v \seqsplit{socket://11.22.33.44} -m \seqsplit{drv:///sample.drv/laserjet.ppd} \tn % Row Count 23 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{SSH}} \tn % Row 0 \SetRowColor{LightBackground} \$ ssh -l \textless{}account name\textgreater{} \textless{}remote system\textgreater{} & log in \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \$ ssh \textless{}account name\textgreater{}@\textless{}remote system\textgreater{} & log in \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \$ ssh \textless{}remote system\textgreater{} & log in if on same local and remote system \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \$ ssh -l \textless{}account name\textgreater{} \textless{}remote system\textgreater{} rm \textless{}absolute path name\textgreater{} & run a single command \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} \$ scp \textless{}file name\textgreater{} \textless{}account name\textgreater{}@\textless{}remote server\textgreater{}: & copy files from local to remote \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \$ scp \textless{}account name\textgreater{}@\textless{}remote system\textgreater{}:\textless{}file name\textgreater{} . & copy files from remote to local \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \$ scp -r \textless{}account name\textgreater{}@\textless{}remote system\textgreater{}t:\textless{}directory\textgreater{} . & copy directory \tn % Row Count 20 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}