\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{River L. (Tamaranth)} \pdfinfo{ /Title (linux-commands-and-options.pdf) /Creator (Cheatography) /Author (River L. (Tamaranth)) /Subject (Linux Commands \& Options 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}{009152} \definecolor{LightBackground}{HTML}{EFF8F4} \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 Commands \& Options Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{River L. (Tamaranth)} via \textcolor{DarkBackground}{\uline{cheatography.com/42882/cs/46551/}}} \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}River L. (Tamaranth) \\ \uline{cheatography.com/tamaranth} \\ \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 24th June, 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{2.128 cm} x{2.736 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Keyboard Shortcuts}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{{\emph{Shortcut}}}} & {\bf{{\emph{What It Does}}}} & {\bf{{\emph{Notes}}}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `{\emph{cmd}}` {\bf{Tab Tab}} & Show all commands that start with "cmd" & \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{Esc}} + {\bf{.}} & Insert last argument entered & Repeat to go back to previous arguments \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} {\bf{Up Arrow}} & Auto-fill last command entered & Repeat to go back to previous commands \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{Ctrl}}+{\bf{Arrow}} \seqsplit{(Right/Left)} & Move to beginning/end of a word & \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} {\bf{Ctrl}}+{\bf{Shift}}+{\bf{T}} & Open new terminal tab & \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{Ctrl}}+{\bf{L}} & Clear terminal output & \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} {\bf{Ctrl}}+{\bf{D}} & Logout / Exit & \tn % Row Count 21 (+ 2) \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}{Important Directories \& Files}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}\{\{width=30\}\}{\bf{{\emph{Directory/File}}}} & \{\{noshy\}\}{\bf{{\emph{(Stands For) Purpose}}}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{/root}} & Root user's home directory \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{/home}} & Normal users' home directories \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{/var}} & (Variables) Database locations, spool files for mail, etc. \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 10 (+ 0) % Row 5 \SetRowColor{white} {\bf{/usr}} & (User System Resources) System resources used by users \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} — /usr{\bf{/bin}} & (Binaries) Executables usable by normal users \tn % Row Count 16 (+ 3) % Row 7 \SetRowColor{white} — /usr{\bf{/sbin}} & (System Binaries) Executables only usable by root user \tn % Row Count 19 (+ 3) % Row 8 \SetRowColor{LightBackground} — /usr{\bf{/lib}} & 52-bit libraries \tn % Row Count 20 (+ 1) % Row 9 \SetRowColor{white} — /usr{\bf{/lib64}} & 64-bit libraries \tn % Row Count 21 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 21 (+ 0) % Row 11 \SetRowColor{white} {\bf{/etc}} & (Extended Text Configurations) Config files \tn % Row Count 24 (+ 3) % Row 12 \SetRowColor{LightBackground} — /etc{\bf{/passwd}} & User account config files \tn % Row Count 26 (+ 2) % Row 13 \SetRowColor{white} — /etc{\bf{/group}} & Group membership info \& config files \tn % Row Count 28 (+ 2) % Row 14 \SetRowColor{LightBackground} — /etc{\bf{/shadow}} & User password info \& config files \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Important Directories \& Files (cont)}} \tn % Row 15 \SetRowColor{LightBackground} — /etc{\bf{/sudoers}} & Main file for sudo config \tn % Row Count 2 (+ 2) % Row 16 \SetRowColor{white} — /etc{\bf{/sudoers.d/}} & Destination for sudo config "dropping files" \tn % Row Count 5 (+ 3) % Row 17 \SetRowColor{LightBackground} — /etc{\bf{/login.defs}} & Defines default properties used for new user accounts \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.28 cm} x{4.72 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{`vim` Editor Controls}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=2\}\}{\bf{-{}-{}- Command Mode -{}-{}-}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{o}} & Starts new line {\bf{and}} switches to Insert mode \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{cw}} & "Change word" - deletes word {\bf{and}} switches to Insert mode \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} {\bf{G}} & Go to end of file \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{dd}} & Delete {\bf{or cut}} entire line \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{yy}} & Copy entire line \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} {\bf{p}} & Paste copied text \tn % Row Count 12 (+ 1) % Row 7 \SetRowColor{white} {\bf{x}} & Delete character cursor is on top of \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{dw}} & Delete word cursor is on top of \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} {\bf{d\$}} & Delete from cursor to end of line \tn % Row Count 18 (+ 2) % Row 10 \SetRowColor{LightBackground} {\bf{ZZ}} & Save \& quit (existing files) \tn % Row Count 20 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=2\}\}{\bf{-{}-{}- Extended Command Mode -{}-{}-}}} \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{:w}} {\emph{filename}} & Save (new files) \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} {\bf{:wq}} & Save \& quit (existing files) \tn % Row Count 26 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.356 cm} x{2.66 cm} x{2.584 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Users \& Groups}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{{\emph{Command}}}} & {\bf{{\emph{Options}}}} & \{\{width=60\}\}{\bf{{\emph{What It Does}}}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `{\bf{id}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Show UID, GID, \& secondary groups\{\{nl\}\}(current user if not specified) & \tn % Row Count 10 (+ 7) % Row 2 \SetRowColor{LightBackground} `{\bf{getent passwd}} {\emph{usr1}}` & \{\{ac\}\}\{\{colspan=2\}\}Find out if usr1 is known to the system & \tn % Row Count 15 (+ 5) % Row 3 \SetRowColor{white} \{\{rowspan=2\}\}`{\bf{useradd}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Add a new user & \tn % Row Count 18 (+ 3) % Row 4 \SetRowColor{LightBackground} & `{\bf{-u}} {\emph{\#}}` & set a specific UID \tn % Row Count 20 (+ 2) % Row 5 \SetRowColor{white} & \{\{nobreak\}\}`{\bf{-s /sbin/nologin}}` & create a user without a login shell \tn % Row Count 23 (+ 3) % Row 6 \SetRowColor{LightBackground} \{\{rowspan=6\}\}`{\bf{usermod}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Change properties of existing user & \tn % Row Count 27 (+ 4) % Row 7 \SetRowColor{white} & `{\bf{-c "}}{\emph{text{\bf{}}"}}` & adds text to comment field \tn % Row Count 29 (+ 2) % Row 8 \SetRowColor{LightBackground} & `{\bf{-g}} {\emph{group1}}` & changes {\bf{primary group}} to group1 \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.356 cm} x{2.66 cm} x{2.584 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Users \& Groups (cont)}} \tn % Row 9 \SetRowColor{LightBackground} & `{\bf{-G}} {\emph{group1}}` & {\bf{replaces}} \seqsplit{supplementary} group with group1 \tn % Row Count 4 (+ 4) % Row 10 \SetRowColor{white} & `{\bf{-aG}} {\emph{group1}}` & {\bf{appends}} group1 to \seqsplit{supplementary} groups \tn % Row Count 8 (+ 4) % Row 11 \SetRowColor{LightBackground} & `{\bf{-L}} {\emph{user1}}` & locks user1's account (instead of deleting) \tn % Row Count 12 (+ 4) % Row 12 \SetRowColor{white} `{\bf{newgrp}} {\emph{group1}}` & \{\{ac\}\}\{\{colspan=2\}\}Change current user's primary group\{\{nl\}\}({\bf{temporary}}; current session only) & \tn % Row Count 19 (+ 7) % Row 13 \SetRowColor{LightBackground} \{\{rowspan=2\}\}`{\bf{userdel}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Deletes user1 but {\bf{not}} their home directory & \tn % Row Count 24 (+ 5) % Row 14 \SetRowColor{white} & `{\bf{-r}}` & deletes both user {\bf{and}} home directory \tn % Row Count 28 (+ 4) % Row 15 \SetRowColor{LightBackground} `{\bf{groups}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Displays simple list of groups user1 is a member of & \tn % Row Count 33 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.356 cm} x{2.66 cm} x{2.584 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Users \& Groups (cont)}} \tn % Row 16 \SetRowColor{LightBackground} `{\bf{passwd}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Set password for user1 & \tn % Row Count 3 (+ 3) % Row 17 \SetRowColor{white} \{\{rowspan=7\}\}`{\bf{chage}} {\emph{user1}}` & \{\{ac\}\}\{\{colspan=2\}\}Change password aging properties for user & \tn % Row Count 8 (+ 5) % Row 18 \SetRowColor{LightBackground} & `{\bf{-m}} {\emph{days}}` & minimum \# of days between password changes \tn % Row Count 12 (+ 4) % Row 19 \SetRowColor{white} & `{\bf{-M}} {\emph{days}}` & maximum \# of days between password changes \tn % Row Count 16 (+ 4) % Row 20 \SetRowColor{LightBackground} & `{\bf{-W}} {\emph{days}}` & warning period before password expires \tn % Row Count 19 (+ 3) % Row 21 \SetRowColor{white} & `{\bf{-I}} {\emph{days}}` & inactivity period (password usable after expiration) \tn % Row Count 23 (+ 4) % Row 22 \SetRowColor{LightBackground} & `{\bf{-d 0}}` & require password change on next login \tn % Row Count 26 (+ 3) % Row 23 \SetRowColor{white} & `{\bf{-E}} {\emph{date}}` & date when {\bf{account}} expires \tn % Row Count 29 (+ 3) % Row 24 \SetRowColor{LightBackground} \{\{nobreak\}\}`{\bf{getent group}} {\emph{grp1}}` & \{\{ac\}\}\{\{colspan=2\}\}Find out if grp1 is known to the system & \tn % Row Count 34 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.356 cm} x{2.66 cm} x{2.584 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Users \& Groups (cont)}} \tn % Row 25 \SetRowColor{LightBackground} \{\{rowspan=3\}\}`{\bf{groupadd}} {\emph{group1}}` & \{\{ac\}\}\{\{colspan=2\}\}Create a new group & \tn % Row Count 3 (+ 3) % Row 26 \SetRowColor{white} & `{\bf{-g}} {\emph{\#}}` & set a specific GID \tn % Row Count 5 (+ 2) % Row 27 \SetRowColor{LightBackground} & `{\bf{-r}}` & create a {\bf{system}} group \tn % Row Count 7 (+ 2) % Row 28 \SetRowColor{white} \{\{rowspan=2\}\}`{\bf{groupmod}} {\emph{group1}}` & \{\{ac\}\}\{\{colspan=2\}\}Change properties of existing group & \tn % Row Count 11 (+ 4) % Row 29 \SetRowColor{LightBackground} & `{\bf{-g}} {\emph{\#}}` & change GID to specified number \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{To set the number of days from today when user's {\bf{account}} expires: \newline `{\bf{chage -E \$(date +}}{\emph{days}} {\bf{\%Y-\%m-\%d)}}` \newline \newline To give full admin privileges to a user or group: \newline `{\bf{echo "}}{[}{\emph{user1}}|{\bf{\%}}{\emph{group1}}{]} {\bf{ALL=(ALL) ALL" \textgreater{}\textgreater{} /etc/sudoers.d/}}{\emph{name}}`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.204 cm} x{2.66 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Managing Processes}} \tn % Row 0 \SetRowColor{LightBackground} \{\{rowspan=3\}\}`{\bf{w}}` & \{\{colspan=2\}\}Displays currently logged-in users, login method, time, \& resource usage info & \{\{width=80\}\} \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} & `{\bf{-{}-from}}` & shows users' IP addresses\{\{nl\}\}(in addition to regular output) \tn % Row Count 12 (+ 5) % Row 2 \SetRowColor{LightBackground} & `{\bf{-u}} {\emph{username}}` & limits output to specified username \tn % Row Count 15 (+ 3) % Row 3 \SetRowColor{white} `{\emph{command}} {\bf{\&}}` & \{\{colspan=2\}\}Starts a new job in the background & \tn % Row Count 19 (+ 4) % Row 4 \SetRowColor{LightBackground} `{\bf{jobs}}` & \{\{colspan=2\}\}Displays jobs running in the background\{\{nl\}\}("{\bf{+}}" = default job) & \tn % Row Count 25 (+ 6) % Row 5 \SetRowColor{white} `{\bf{fg \%}}{\emph{1}}` & \{\{colspan=2\}\}Brings job 1 to the foreground & \tn % Row Count 29 (+ 4) % Row 6 \SetRowColor{LightBackground} `{\bf{bg \%}}{\emph{1}}` & \{\{colspan=2\}\}Sends job 1 to the background & \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.204 cm} x{2.66 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Managing Processes (cont)}} \tn % Row 7 \SetRowColor{LightBackground} `{\bf{pidof}} {\emph{command}}` & \{\{colspan=2\}\}Returns the PID(s) of a currently running job & \tn % Row Count 5 (+ 5) % Row 8 \SetRowColor{white} `{\bf{systemctl status}} {\emph{cmd}}` & \{\{colspan=2\}\}Shows main PID of a process, among other things\{\{nl\}\}(can use if `pidof` returns multiple) & \tn % Row Count 13 (+ 8) % Row 9 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=3\}\}{\bf{-{}-{}- CPU Load Handling -{}-{}-}}} \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{white} `{\bf{uptime}}` & \{\{colspan=2\}\}Displays the load average for the last 1, 5, and 15 mins & \tn % Row Count 19 (+ 5) % Row 11 \SetRowColor{LightBackground} \{\{rowspan=2\}\}`{\bf{lscpu}}` & \{\{colspan=2\}\}Displays number of CPUs in the system, among other things & \tn % Row Count 24 (+ 5) % Row 12 \SetRowColor{white} & `{\bf{-p}}` & simplified output\{\{nl\}\}(each row of numbers = 1 CPU) \tn % Row Count 28 (+ 4) % Row 13 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=3\}\}{\bf{-{}-{}- Viewing \& Managing Processes -{}-{}-}}} \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.204 cm} x{2.66 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Managing Processes (cont)}} \tn % Row 14 \SetRowColor{LightBackground} \{\{rowspan=5\}\}`{\bf{ps}}` & \{\{colspan=2\}\}Shows info about processes; pipe to \seqsplit{`head`/`grep`/etc} for less output\{\{nl\}\}("{\bf{{[}}}`{\emph{output}}`{\bf{{]}}}" = kernel thread) & \tn % Row Count 10 (+ 10) % Row 15 \SetRowColor{white} & `{\bf{aux}}` & \tn % Row Count 11 (+ 1) % Row 16 \SetRowColor{LightBackground} & `{\bf{lax}}` & \tn % Row Count 12 (+ 1) % Row 17 \SetRowColor{white} & `{\bf{-ef}}` & \tn % Row Count 13 (+ 1) % Row 18 \SetRowColor{LightBackground} & \{\{nobreak\}\}`{\bf{-{}-forest}}` & shows output in visual "tree" format \tn % Row Count 16 (+ 3) % Row 19 \SetRowColor{white} \{\{rowspan=2\}\}`{\bf{pstree}}` & \{\{colspan=2\}\}Shows processes in visual tree format\{\{nl\}\}{\emph{(may not always be installed)}} & \tn % Row Count 23 (+ 7) % Row 20 \SetRowColor{LightBackground} & `{\bf{-p}}` & includes PIDs in tree output \tn % Row Count 25 (+ 2) % Row 21 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 25 (+ 0) % Row 22 \SetRowColor{LightBackground} \{\{rowspan=5\}\}`{\bf{top}}` & \{\{colspan=2\}\}Linux's in-terminal equivalent of Task Manager\{\{nl\}\}(Also shows load average)\{\{nl\}\}Keyboard Controls: & \tn % Row Count 34 (+ 9) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.204 cm} x{2.66 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Managing Processes (cont)}} \tn % Row 23 \SetRowColor{LightBackground} & {\bf{k}} & send a signal to a process from within `top` \tn % Row Count 4 (+ 4) % Row 24 \SetRowColor{white} & {\bf{Shift}}+{\bf{M}} & sort by memory usage \tn % Row Count 6 (+ 2) % Row 25 \SetRowColor{LightBackground} & {\bf{Shift}}+{\bf{P}} & return to sorting by CPU usage \tn % Row Count 9 (+ 3) % Row 26 \SetRowColor{white} & {\bf{l}} / {\bf{t}} / {\bf{m}} & toggle "load", "threads", \& "memory" header lines \tn % Row Count 13 (+ 4) % Row 27 \SetRowColor{LightBackground} \{\{rowspan=3\}\}`{\bf{kill}} {\emph{PID}}` & \{\{colspan=2\}\}Sends signal 15 to specified process\{\{nl\}\}{\bf{*}} {\emph{Must use process ID}} {\bf{*}} & \tn % Row Count 20 (+ 7) % Row 28 \SetRowColor{white} & `{\bf{-}}{\emph{signal}}` & sends specified signal\{\{nl\}\}(can use signal name or number) \tn % Row Count 25 (+ 5) % Row 29 \SetRowColor{LightBackground} & `{\bf{-l}}` & displays list of signal options \tn % Row Count 28 (+ 3) % Row 30 \SetRowColor{white} `{\bf{killall}} {\emph{process}}` & \{\{colspan=2\}\}Kills processes by name instead of PID & \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.204 cm} x{2.66 cm} x{2.736 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Managing Processes (cont)}} \tn % Row 31 \SetRowColor{LightBackground} \{\{rowspan=4\}\}`{\bf{pkill}}` & \{\{colspan=2\}\}Look up \& manage processes by name or other attributes\{\{nl\}\}(default is signal 15) & \tn % Row Count 7 (+ 7) % Row 32 \SetRowColor{white} & `{\bf{-}}{\emph{signal}}` & specify signal to send \tn % Row Count 9 (+ 2) % Row 33 \SetRowColor{LightBackground} & `{\bf{-u}} {\emph{username}}` & sends signal to user's account\{\{nl\}\}(forces logout \& shuts down their processes) \tn % Row Count 15 (+ 6) % Row 34 \SetRowColor{white} & `{\bf{-t}} {\emph{pts/22}}` & kills specified terminal session (TTY) \tn % Row Count 18 (+ 3) % Row 35 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 18 (+ 0) % Row 36 \SetRowColor{white} `{\bf{nice -n}} {\emph{x command}}` & \{\{colspan=2\}\}Starts a {\bf{new}} process with an adjusted priority value ({\emph{x}})\{\{nl\}\} & \tn % Row Count 24 (+ 6) % Row 37 \SetRowColor{LightBackground} `{\bf{renice -n}} {\emph{x}} {\bf{-p}} {\emph{PID}}` & \{\{colspan=2\}\}Change the priority value ({\emph{x}}) of an {\bf{existing}} process & \tn % Row Count 30 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{Process Priority Values: {\bf{-20}} to {\bf{19}} (default = {\bf{0}}) \newline {\emph{({\bf{negative}} = {\bf{higher}} priority}} | {\bf{{\emph{positive}} = {\bf{lower}} priority)}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{SSH}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}\{\{rowspan=6\}\}`{\bf{ssh}} {\emph{user{\bf{}}@}}{\emph{ip.addr}}` & \{\{ac\}\}\{\{colspan=2\}\}Start ssh connection & \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} & `{\bf{-v}}` & verbose; shows in detail what's happening while establishing connection \tn % Row Count 11 (+ 6) % Row 2 \SetRowColor{LightBackground} & `{\bf{-Y}}` & enables graphical application support \tn % Row Count 14 (+ 3) % Row 3 \SetRowColor{white} & `{\bf{-p}} {\emph{port\#}}` & connect to ssh service not listening on default port 22 \tn % Row Count 19 (+ 5) % Row 4 \SetRowColor{LightBackground} & `{\bf{-i}} {\emph{keyfile}}` & reads private key from identity file for public key authentication\{\{nl\}\}(not part of lecture; added from Google search when it came up in the quiz) \tn % Row Count 31 (+ 12) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{SSH (cont)}} \tn % Row 5 \SetRowColor{LightBackground} & \{\{nobreak\}\}`{\bf{-o}} {\emph{option}} {\emph{dest\_server}}`\{\{nl\}\}\{\{nl\}\}Example:\{\{nl\}\}`PreferredAuthenti\{\{nl\}\}cations=password` & configures options when connecting to specified destination\{\{nl\}\}(Example: require a password; can use commas to specify multiple) \tn % Row Count 10 (+ 10) % Row 6 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 10 (+ 0) % Row 7 \SetRowColor{LightBackground} \{\{rowspan=2\}\}`{\bf{ssh-keygen}}` & \{\{ac\}\}\{\{colspan=2\}\}Generates a \seqsplit{public/private} key pair & \tn % Row Count 15 (+ 5) % Row 8 \SetRowColor{white} & `{\bf{-N}} '' {\bf{-f}} {\emph{filename}}` & generates key pair without extra prompts\{\{nl\}\}(`''` = no passphrase; `-f` specifies non-default file location) \tn % Row Count 24 (+ 9) % Row 9 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 24 (+ 0) % Row 10 \SetRowColor{white} \{\{rowspan=2\}\}`{\bf{ssh-copy-id}} {\emph{user@server}}` & \{\{ac\}\}\{\{colspan=2\}\}Installs public key on destination server & \tn % Row Count 29 (+ 5) % Row 11 \SetRowColor{LightBackground} & `{\bf{-i}} {\emph{filepath}}` & specifies which public key to install \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{SSH (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{2.888 cm} x{2.888 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Wildcards \& Shortcuts}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{{\emph{Wildcard}}}} & {\bf{{\emph{What It Represents}}}} & {\bf{{\emph{Example}}}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `{\bf{\textasciitilde{}}}` & Current user's home directory & \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} `{\bf{.}}` & The directory you're currently in & \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} `{\bf{..}}` & Parent directory of your current directory & \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} `{\bf{*}}` & All files in current directory & `{\bf{ls i}}*` = all files starting with "i" \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} `{\bf{?}}` & "Any character" & `{\bf{f??e}}` matches anything with 4 characters that starts with "f" \& ends with "e" \tn % Row Count 20 (+ 6) % Row 6 \SetRowColor{LightBackground} `{\bf{{[}}}{\emph{aou{\bf{}}{]}}}` & Match to any {\bf{one}} of the enclosed characters & `{\bf{c{[}aou{]}t}}` matches to "cat", "cot", and "cut" \tn % Row Count 24 (+ 4) % Row 7 \SetRowColor{white} `{\bf{!!}}` & "Last command run" (inserts into current command) & `{\bf{sudo !!}}` = rerun command as root \tn % Row Count 28 (+ 4) % Row 8 \SetRowColor{LightBackground} `{\bf{\textasciicircum{}}}{\emph{x{\bf{}}\textasciicircum{}}}{\emph{y}}` & Rerun last command but replace {\emph{x}} with {\emph{y}} & `{\bf{ls /usr}}` followed by `{\bf{\textasciicircum{}usr\textasciicircum{}tmp}}` will run `{\bf{ls /tmp}}` \tn % Row Count 33 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{2.888 cm} x{2.888 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Wildcards \& Shortcuts (cont)}} \tn % Row 9 \SetRowColor{LightBackground} `{\bf{!3}}` & Rerun 3rd command from command history & \tn % Row Count 3 (+ 3) % Row 10 \SetRowColor{white} `{\bf{!ls}}` & Runs most recent command from history that had "ls" in it & \tn % Row Count 7 (+ 4) \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}{Command Redirection}} \tn % Row 0 \SetRowColor{LightBackground} `{\bf{\textless{}}}` & Gets input from somewhere other than stdin (keyboard) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `{\bf{\textgreater{}}}` & Sends output somewhere other than stdout (monitor) \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} `{\bf{1\textgreater{}}}` & Alternative to "\textgreater{}" (not really used) \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} `{\bf{\textgreater{}\textgreater{}}}` & Redirects stdout; {\bf{appends}} it to existing content (instead of overwriting it) \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} `{\bf{2\textgreater{}}}` & Redirects only error messages (stderr) \tn % Row Count 13 (+ 2) % Row 5 \SetRowColor{white} `{\bf{\&\textgreater{}}}` & Redirects both stdout and stderr \tn % Row Count 15 (+ 2) % Row 6 \SetRowColor{LightBackground} `{\emph{cmd1}} {\bf{|}} {\emph{cmd2}}` & Pipes {\emph{cmd1}} into {\emph{cmd2}}\{\{nl\}\}(uses the {\bf{output}} of cmd1 as the {\bf{input}} for cmd2) \tn % Row Count 19 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Basic File/Directory Commands}} \tn % Row 0 \SetRowColor{LightBackground} \{\{rowspan=5\}\}`{\bf{ls}} {\emph{dir1}}` & \{\{ac\}\}\{\{colspan=2\}\}List contents of dir1 & \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} & `{\bf{-l}}` & additional info (owner, perms, etc.) \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} & `{\bf{-a}}` & lists all, including hidden files \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} & `{\bf{-i}}` & adds file inode to info displayed \tn % Row Count 13 (+ 3) % Row 4 \SetRowColor{LightBackground} & `{\bf{-d}}` & info for directory itself (rather than its contents) \tn % Row Count 17 (+ 4) % Row 5 \SetRowColor{white} \{\{rowspan=3\}\}`{\bf{mkdir}} {\emph{dir1}}` & \{\{ac\}\}\{\{colspan=2\}\}Create a new directory & \tn % Row Count 21 (+ 4) % Row 6 \SetRowColor{LightBackground} & `{\bf{-p}}` & creates full path (multiple directories if needed) \tn % Row Count 25 (+ 4) % Row 7 \SetRowColor{white} & `{\bf{-v}}` & verbose (output shows action taken) \tn % Row Count 28 (+ 3) % Row 8 \SetRowColor{LightBackground} \{\{rowspan=3\}\}`{\bf{cp}} {\emph{dir1 dir2}}` & & \{\{colspan=2\}\}Copy dir1 into dir2 \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Basic File/Directory Commands (cont)}} \tn % Row 9 \SetRowColor{LightBackground} & `{\bf{-r}}` & recursively ("and its contents") \tn % Row Count 3 (+ 3) % Row 10 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 3 (+ 0) % Row 11 \SetRowColor{LightBackground} \{\{rowspan=3\}\}`{\bf{rm}} {\emph{dir1}}` & \{\{ac\}\}\{\{colspan=2\}\}Removes (deletes) an empty directory & \tn % Row Count 8 (+ 5) % Row 12 \SetRowColor{white} & `{\bf{-r}}` & recursively ("and it's contents"), including special files \tn % Row Count 13 (+ 5) % Row 13 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 13 (+ 0) % Row 14 \SetRowColor{white} \{\{rowspan=3\}\}`{\bf{mv}} {\emph{file1}} {\emph{dir1}}` & \{\{ac\}\}\{\{colspan=2\}\}Move file1 into dir1 & \tn % Row Count 16 (+ 3) % Row 15 \SetRowColor{LightBackground} & `{\bf{-v}}` & verbose (output shows action taken) \tn % Row Count 19 (+ 3) % Row 16 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 19 (+ 0) % Row 17 \SetRowColor{LightBackground} \{\{nobreak\}\}\{\{rowspan=2\}\}`{\bf{ln}} {\emph{target}} {\emph{link}}` & \{\{ac\}\}\{\{colspan=2\}\}Creates a hard link from file "link" to file "target" & \tn % Row Count 25 (+ 6) % Row 18 \SetRowColor{white} & `{\bf{-s}}` & makes a symbolic link instead of a hard link \tn % Row Count 29 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Ownership \& Permissions}} \tn % Row 0 \SetRowColor{LightBackground} `{\bf{chown}} {\emph{user{\bf{}}:}}{\emph{group}}` & \{\{ac\}\}\{\{colspan=2\}\}Change owning user {\bf{and}} owning group & \{\{width=80\}\} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} `{\bf{chown :}}{\emph{group}}` & \{\{ac\}\}\{\{colspan=2\}\}Change only owning group & \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} `{\bf{chgrp}} {\emph{group file}}` & \{\{ac\}\}\{\{colspan=2\}\}Alternate way to change owning group & \tn % Row Count 14 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 14 (+ 0) % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}\{\{rowspan=6\}\}`{\bf{chmod}} {[}{\emph{perms}}{]} {\emph{file}}` & \{\{ac\}\}\{\{colspan=2\}\}Change \seqsplit{file/directory} permissions & \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} & `{\bf{-R}}` & recursive; applies to directory and all contents \tn % Row Count 22 (+ 4) % Row 6 \SetRowColor{LightBackground} & `{\bf{g+r}}` & grants owning {\bf{g}}roup the {\bf{r}}ead permission \tn % Row Count 26 (+ 4) % Row 7 \SetRowColor{white} & `{\bf{a-x}}` & removes e{\bf{x}}ecute perms for {\bf{a}}ll parties (without changing other perms) \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Ownership \& Permissions (cont)}} \tn % Row 8 \SetRowColor{LightBackground} & \{\{nobreak\}\}`{\bf{-R a=rwX}}` & recursively set perms for {\bf{a}}ll parties to {\bf{rw}}, with {\bf{x}} perms on directory {\bf{only}} \tn % Row Count 7 (+ 7) % Row 9 \SetRowColor{white} & `{\bf{770}}` & octally set rwx perms for owning user \& group, 0 for other \tn % Row Count 12 (+ 5) % Row 10 \SetRowColor{LightBackground} \{\{rowspan=8\}\}`{\bf{chmod}} {[}{\emph{perms}}{]} {\emph{file}}` & \{\{ac\}\}\{\{colspan=2\}\}(cont'd) Change special permissions & \tn % Row Count 17 (+ 5) % Row 11 \SetRowColor{white} & `{\bf{o+t}} {\emph{dir}}` & set S{\bf{t}}icky bit (in {\bf{o}}ther)\{\{nl\}\}{\bf{*}} {\emph{For directories only}} {\bf{*}} \tn % Row Count 23 (+ 6) % Row 12 \SetRowColor{LightBackground} & `{\bf{1}}{\emph{xxx}}` & set Sticky bit – octal form\{\{nl\}\}({\emph{xxx}} = regular perms) \tn % Row Count 28 (+ 5) % Row 13 \SetRowColor{white} & `{\bf{g+s}} {\emph{dir/file}}` & set {\bf{S}}etGID bit (in {\bf{g}}roup)\{\{nl\}\}{\bf{*}} {\emph{For directories and files}} {\bf{*}} \tn % Row Count 35 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Ownership \& Permissions (cont)}} \tn % Row 14 \SetRowColor{LightBackground} & `{\bf{2}}{\emph{xxx}}` & set SetGID bit – octal form \tn % Row Count 3 (+ 3) % Row 15 \SetRowColor{white} & `{\bf{3}}{\emph{xxx}}` & set {\bf{both}} Sticky \& SetGID bits\{\{nl\}\}(chmod "1"+"2") \tn % Row Count 8 (+ 5) % Row 16 \SetRowColor{LightBackground} & `{\bf{u+s}} {\emph{file}}` & set {\bf{S}}etUID bit (in {\bf{u}}ser)\{\{nl\}\}{\bf{*}} {\emph{For files only}} {\bf{*}} \tn % Row Count 14 (+ 6) % Row 17 \SetRowColor{white} & `{\bf{4}}{\emph{xxx}}` & set SetUID bit – octal form \tn % Row Count 17 (+ 3) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 17 (+ 0) % Row 19 \SetRowColor{white} \{\{rowspan=3\}\}`{\bf{umask}}` & \{\{ac\}\}\{\{colspan=2\}\}Displays currently set umask\{\{nl\}\}(when used by itself) & \tn % Row Count 23 (+ 6) % Row 20 \SetRowColor{LightBackground} & `{\bf{077}}` & removes default perms\{\{nl\}\}(0 from user, 7 from group/other) \tn % Row Count 28 (+ 5) % Row 21 \SetRowColor{white} & `{\bf{0077}}` & preserves any special perms when removing defaults \tn % Row Count 32 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{Octal Expression Values: {\bf{r}}={\bf{4}} | {\bf{w}}={\bf{2}} | {\bf{x}}={\bf{1}} \newline \newline Default permissions (on vanilla Linux): \newline {\bf{directories}}={\bf{777}} | {\bf{files}}={\bf{666}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{2.204 cm} x{3.572 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Process States \& Signals}} \tn % Row 0 \SetRowColor{LightBackground} Running & `{\bf{R}}` & currently using CPU \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Runnable & `{\bf{R}}` & queued \& waiting for CPU time \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{rowspan=4\}\}Sleeping & `{\bf{S}}` & defined (has PID) but not requesting CPU time \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} & \{\{nobreak\}\}`{\bf{I}}` (idle) & not counted when calculating load \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} & `{\bf{D}}` & {\emph{(not yet addressed)}} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} & `{\bf{K}}` & {\emph{(not yet addressed)}} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 14 (+ 0) % Row 7 \SetRowColor{white} Stopped & `{\bf{T}}` & defined (has PID) but prevented from getting CPU cycles \tn % Row Count 18 (+ 4) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=3\}\}{\bf{-{}-{}- Signals -{}-{}-}}} \tn % Row Count 19 (+ 1) % Row 9 \SetRowColor{white} `{\bf{1) SIGHUP}}` & Hang Up & toss current config file in memory \& reload it from the file system \tn % Row Count 23 (+ 4) % Row 10 \SetRowColor{LightBackground} `{\bf{9) SIGKILL}}` & \{\{nobreak\}\}Kill it dead! & immediately end process that isn't responding to "terminate" signal \tn % Row Count 27 (+ 4) % Row 11 \SetRowColor{white} `{\bf{15) SIGTERM}}` & Terminate & shut down process\{\{nl\}\}(default used by `kill`) \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{2.204 cm} x{3.572 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Process States \& Signals (cont)}} \tn % Row 12 \SetRowColor{LightBackground} `{\bf{18) SIGCONT}}` & Continue\{\{nl\}\}("unstop") & resume allowing process to get CPU time \tn % Row Count 3 (+ 3) % Row 13 \SetRowColor{white} `{\bf{19) SIGSTOP}}` & Stop & suspend process \& prevent from getting CPU time \tn % Row Count 6 (+ 3) \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}{Managing Services \& Daemons}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=2\}\}{\bf{-{}-{}- System Commands -{}-{}-}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `{\bf{systemctl reboot}}` & reboots the system \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `{\bf{systemctl daemon-reload}}` & \{\{colspan=2\}\}tells systemd you've made changes to a unit file \& it needs to reinitialize those unit files \tn % Row Count 9 (+ 6) % Row 3 \SetRowColor{white} `{\bf{systemctl get-default}}` & shows which target is the default target that the system summons whenever it starts up \tn % Row Count 14 (+ 5) % Row 4 \SetRowColor{LightBackground} `{\bf{systemctl set-default}} {\emph{graphical.target}}` & sets default target to "graphical.target" \tn % Row Count 17 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ac\}\}\{\{colspan=2\}\}{\bf{-{}-{}- Unit Commands -{}-{}-}}} \tn % Row Count 18 (+ 1) % Row 6 \SetRowColor{LightBackground} `{\bf{systemctl list-units}}` & shows all the active \& loaded units on the system \tn % Row Count 21 (+ 3) % Row 7 \SetRowColor{white} \{\{ar\}\}`{\bf{-t}} {\emph{type}}` & filters output by specified type of unit \tn % Row Count 23 (+ 2) % Row 8 \SetRowColor{LightBackground} \{\{ar\}\}`{\bf{-a}}` & shows all units known to systemd\{\{nl\}\}(including "inactive" \& "not-found") \tn % Row Count 27 (+ 4) % Row 9 \SetRowColor{white} `{\bf{systemctl status}} {\emph{unit}}` & shows status \& details of specified unit (including location of unit files) \tn % Row Count 31 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Managing Services \& Daemons (cont)}} \tn % Row 10 \SetRowColor{LightBackground} `{\bf{systemctl is-enabled}} {\emph{unit.service}}` & shows whether the service is enabled\{\{nl\}\}(i.e. will start automatically on system boot) \tn % Row Count 5 (+ 5) % Row 11 \SetRowColor{white} `{\bf{systemctl is-active}} {\emph{unit.service}}` & shows whether the service is active \tn % Row Count 7 (+ 2) % Row 12 \SetRowColor{LightBackground} `{\bf{systemctl enable -{}-now}} {\emph{unit.service}}` & enables the service \& start it immediately (sets "enable" persistently) \tn % Row Count 11 (+ 4) % Row 13 \SetRowColor{white} `{\bf{systemctl disable -{}-now}} {\emph{unit}}` & stops service immediately \& sets to "disabled" persistently \tn % Row Count 14 (+ 3) % Row 14 \SetRowColor{LightBackground} `{\bf{systemctl reload}} {\emph{unit}}` & sends the "hang up" signal; drops config file loaded in memory \& reload it from file system \tn % Row Count 19 (+ 5) % Row 15 \SetRowColor{white} `{\bf{systemctl restart}} {\emph{unit}}` & kills the process \& starts it up again fresh\{\{nl\}\}(main PID will change) \tn % Row Count 23 (+ 4) % Row 16 \SetRowColor{LightBackground} `{\bf{systemctl reload-or-restart}} {\emph{unit}}` & reloads if possible, otherwise restart\{\{nl\}\}(for when you don't know if unit supports reload) \tn % Row Count 28 (+ 5) % Row 17 \SetRowColor{white} \{\{nobreak\}\}`{\bf{systemctl list-dependencies}} {\emph{unit.service}}` & \{\{colspan=2\}\}shows list of units required by {\emph{unit.service}} for it to work \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Managing Services \& Daemons (cont)}} \tn % Row 18 \SetRowColor{LightBackground} \{\{ar\}\}`{\bf{-{}-reverse}}` & shows units that call {\emph{unit.service}} \tn % Row Count 2 (+ 2) % Row 19 \SetRowColor{white} `{\bf{systemctl mask}} {\emph{unit}}` & prevents unit from being started automatically {\bf{or}} manually\{\{nl\}\}(not even via `enable -{}-now` command) \tn % Row Count 8 (+ 6) % Row 20 \SetRowColor{LightBackground} `{\bf{systemctl unmask}} {\emph{unit}}` & undoes masking on a service \tn % Row Count 10 (+ 2) \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}{Network Info Commands}} \tn % Row 0 \SetRowColor{LightBackground} `{\bf{ip -br addr}}` & shows current IP \& netmask for all interfaces \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `{\bf{ip link show}}` & link-level properties of all interfaces (MAC addresses, etc.) \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} `{\bf{ip address show}}` & equivalent of `ipconfig`\{\{nl\}\}(same info as `link show`, plus IP addresses) \tn % Row Count 11 (+ 4) % Row 3 \SetRowColor{white} `{\bf{ip a s}}` & abbreviated form of `ip address show` \tn % Row Count 13 (+ 2) % Row 4 \SetRowColor{LightBackground} `{\bf{ip route show}}` & shows default route \tn % Row Count 14 (+ 1) % Row 5 \SetRowColor{white} `{\bf{ip r s}}` & abbreviated form of `ip route show` \tn % Row Count 16 (+ 2) % Row 6 \SetRowColor{LightBackground} `{\bf{ping}}` | `{\bf{ping6}}` & IPv4 ping | IPv6 ping \tn % Row Count 18 (+ 2) % Row 7 \SetRowColor{white} \{\{nobreak\}\}`{\bf{tracepath}}` | `{\bf{tracepath6}}` & equivalent of \seqsplit{`tracert`/`traceroute`} | IPv6 version \tn % Row Count 21 (+ 3) % Row 8 \SetRowColor{LightBackground} `{\bf{mtr}} {\emph{address}}` & "My traceroute" program; gives extra info \& continuous running stats \tn % Row Count 25 (+ 4) % Row 9 \SetRowColor{white} `{\bf{nmap -sS}} {\emph{host}}` & scans ports on host; shows port number/type, open state, associated service, etc. \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Network Info Commands (cont)}} \tn % Row 10 \SetRowColor{LightBackground} `{\bf{ss}}` & {\bf{s}}ockets {\bf{s}}tate information \tn % Row Count 2 (+ 2) % Row 11 \SetRowColor{white} `{\bf{ss -p}}` & {\bf{p}}rocesses responsible for opening ports \tn % Row Count 5 (+ 3) % Row 12 \SetRowColor{LightBackground} `{\bf{ss -l}}` & {\bf{l}}istening sockets \tn % Row Count 7 (+ 2) % Row 13 \SetRowColor{white} `{\bf{ss -u}}` & {\bf{U}}DP sockets \tn % Row Count 8 (+ 1) % Row 14 \SetRowColor{LightBackground} `{\bf{ss -n}}` & translates names to {\bf{n}}umbers\{\{nl\}\}(e.g. both process name \& PID) \tn % Row Count 12 (+ 4) % Row 15 \SetRowColor{white} `{\bf{ss -t}}` & {\bf{T}}CP sockets \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.672 cm} x{2.964 cm} x{2.964 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Misc. Commands}} \tn % Row 0 \SetRowColor{LightBackground} `{\bf{whatis}} {\emph{command}}` & \{\{ac\}\}\{\{colspan=2\}\}Displays a short, one-line summary of what the command does & \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} `{\bf{echo}}` & \{\{ac\}\}\{\{colspan=2\}\}Creates output (equivalent of `print` in Python) & \tn % Row Count 11 (+ 5) % Row 2 \SetRowColor{LightBackground} \{\{rowspan=4\}\}`{\bf{date}}` & \{\{ac\}\}\{\{colspan=2\}\}Displaying, setting, calculating...\{\{nl\}\}basically all things date-related & \{\{width=80\}\} \tn % Row Count 18 (+ 7) % Row 3 \SetRowColor{white} & `{\bf{+\%F}}` & display current date in international format (YYYY-mm-dd) \tn % Row Count 22 (+ 4) % Row 4 \SetRowColor{LightBackground} & `{\bf{+\%R}}` & display current time (24-hr clock) \tn % Row Count 25 (+ 3) % Row 5 \SetRowColor{white} & `{\bf{+\%s}}` & display \# of seconds since epoch \tn % Row Count 28 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 28 (+ 0) % Row 7 \SetRowColor{white} `{\bf{tmux}}` & \{\{ac\}\}\{\{colspan=2\}\}Splits terminal window into multiple separate panes\{\{nl\}\}{\bf{{\emph{(I think)}}}} & \tn % Row Count 35 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.672 cm} x{2.964 cm} x{2.964 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Misc. Commands (cont)}} \tn % Row 8 \SetRowColor{LightBackground} `{\bf{gnome-characters}}` & \{\{ac\}\}\{\{colspan=2\}\}Opens window of gnome icons/emotes & \tn % Row Count 4 (+ 4) % Row 9 \SetRowColor{white} `{\bf{gnome-calculator}}` & \{\{ac\}\}\{\{colspan=2\}\}Opens built-in calculator (like Windows) & \tn % Row Count 8 (+ 4) % Row 10 \SetRowColor{LightBackground} `{\bf{sleep}} {\emph{seconds}}` & \{\{ac\}\}\{\{colspan=2\}\}Waits \& does nothing for specified time & \tn % Row Count 12 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}