\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 8th 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.356 cm} x{2.356 cm} x{2.888 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} {\bf{Esc}} + {\bf{.}} & Insert last argument entered & Repeat to go back to previous arguments \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{Up Arrow}} & Auto-fill last command entered & Repeat to go back to previous commands \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} {\bf{Ctrl}}+{\bf{D}} & Logout / Exit & \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{Ctrl}}+{\bf{L}} & Clear terminal output & \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} {\bf{Ctrl}}+{\bf{Shift}}+{\bf{T}} & Open new terminal tab & \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{Ctrl}}+{\bf{Arrow}} \seqsplit{(Right/Left)} & Move to \seqsplit{beginning/end} of a word & \tn % Row Count 17 (+ 3) \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{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) Configuration 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.584 cm} x{2.508 cm} x{2.508 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Misc. Commands}} \tn % Row 0 \SetRowColor{LightBackground} \{\{rowspan=4\}\}`{\bf{date}}` & \{\{ac\}\}\{\{colspan=2\}\}Displaying, setting, \seqsplit{calculating..}.\{\{nl\}\}basically all things date-related & \{\{width=80\}\} \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} & `{\bf{+\%F}}` & display current date in \seqsplit{international} format (YYYY-mm-dd) \tn % Row Count 13 (+ 5) % Row 2 \SetRowColor{LightBackground} & `{\bf{+\%R}}` & display current time (24-hr clock) \tn % Row Count 16 (+ 3) % Row 3 \SetRowColor{white} & `{\bf{+\%s}}` & display \# of seconds since epoch \tn % Row Count 19 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{} \tn % Row Count 19 (+ 0) % Row 5 \SetRowColor{white} \{\{nobreak\}\}\{\{rowspan=5\}\}`{\bf{ssh}} {\emph{user{\bf{}}@}}{\emph{ip.addr}}` & \{\{ac\}\}\{\{colspan=2\}\}Start ssh connection & \tn % Row Count 24 (+ 5) % Row 6 \SetRowColor{LightBackground} & `{\bf{-v}}` & verbose; shows in detail what's happening while establishing connection \tn % Row Count 30 (+ 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}{Misc. Commands (cont)}} \tn % Row 7 \SetRowColor{LightBackground} & `{\bf{-Y}}` & enables graphical application support \tn % Row Count 3 (+ 3) % Row 8 \SetRowColor{white} & `{\bf{-p}} {\emph{port\#}}` & connect to ssh service not listening on default port 22 \tn % Row Count 8 (+ 5) % Row 9 \SetRowColor{LightBackground} & \{\{nobreak\}\}`{\bf{-i}} {\emph{keyfile}}` & reads private key from identity file for public key \seqsplit{authentication} \tn % Row Count 14 (+ 6) % Row 10 \SetRowColor{white} `{\bf{echo}}` & \{\{ac\}\}\{\{colspan=2\}\}Creates output (equivalent of `print` in Python) & \tn % Row Count 20 (+ 6) % Row 11 \SetRowColor{LightBackground} `{\bf{tmux}}` & \{\{ac\}\}\{\{colspan=2\}\}Split terminal window into 4 separate panes\{\{nl\}\}{\bf{{\emph{(I think)}}}} & \tn % Row Count 27 (+ 7) % Row 12 \SetRowColor{white} `{\bf{ps -au}}` & \{\{ac\}\}\{\{colspan=2\}\}Show current processes \& which user started them & \tn % Row Count 33 (+ 6) \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.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} % That's all folks \end{multicols*} \end{document}