\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{beersj02} \pdfinfo{ /Title (linux-bash-and-system-administration.pdf) /Creator (Cheatography) /Author (beersj02) /Subject (Linux, Bash, and System Administration 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}{312A5E} \definecolor{LightBackground}{HTML}{F8F8F9} \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, Bash, and System Administration Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{beersj02} via \textcolor{DarkBackground}{\uline{cheatography.com/89657/cs/20407/}}} \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}beersj02 \\ \uline{cheatography.com/beersj02} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 5th December, 2019.\\ Updated 5th December, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bash Scripting Basics}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#!/bin/env bash}} — the 'shebang' used to tell the operating system the path it should use to interpret the file} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{bash {\emph{file-name}}.sh}} — run the bash script in terminal} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{./ {\emph{file-name}}.sh}} — run the bash script in terminal if set to executable} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\textless{}{\emph{parameter}}\textgreater{}}} — use in documentation to specify if a parameter is required when running script} \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{{[}{\emph{parameter}}{]}}} — use in documentation to specify is a parameter is optional when running script} \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\#}} — used to make comments throughout script} \tn % Row Count 12 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{||}} — logical OR} \tn % Row Count 13 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\&\&}} — logical AND} \tn % Row Count 14 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$\#}} — resolved to the number of arguments that have been passed to the script} \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$0}} — refer back to the script name} \tn % Row Count 17 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$1, \$2, etc.}} — refer to user input (parameters) that user can add when running script, separated by a space} \tn % Row Count 20 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{exit {[}0-255{]}}} — exit script and return number from 0 to 255. 0 means everything worked as intended, but other values can be used to denote errors that the script ran into} \tn % Row Count 24 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bash Loops and Conditions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{if fi}} — basic structure of all if-then-exit, if-then-else, or if-elif-else statements} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{if {\emph{condition }}; then {\emph{do-something}}}} — if condition is met, do something} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{if {\emph{condition }}; then {\emph{do-something}} else {\emph{do-something-else}}}} — if condition is met, do something, otherwise do something else} \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{if {\emph{condition }}; then {\emph{do-something}} elif {\emph{condition2 }}; then {\emph{do-something-else}} else {\emph{do-final-thing}}}} — if condition is met, do something; however if a different condition is met, then do something else; otherwise do the final thing} \tn % Row Count 12 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{while {\emph{condition-is-true }}; do {\emph{action}} done}} — perform the action as long as the condition is true} \tn % Row Count 15 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{until {\emph{condition-is-true }}; do {\emph{action}} done}} — opposite of while loop, perform the action until the condition becomes true} \tn % Row Count 18 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{sleep {\emph{time}}}} — sleep or wait for a specified number of second before continuing through script, usually performed within loops} \tn % Row Count 21 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{for {\emph{value}} in {\emph{list-of-values }}; do {\emph{thing-with-value}} done}} — iterate over a list of values} \tn % Row Count 23 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{for (({\emph{counter=number }}; {\emph{counter\textless{}=number }}; {\emph{counter++}} )); do {\emph{something}} done}} — start at counter is equal to a number, then do something and increment the counter by 1 until the counter is greater than another number} \tn % Row Count 28 (+ 5) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{for counter in \{{\emph{starting-value}}..{\emph{ending-value}}\}; do {\emph{something}} done}} — brace expansion that iterates over a number range or character range from starting value to the ending value} \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bash Loops and Conditions (cont)}} \tn % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\{{\emph{starting-value}}..{\emph{ending-value}}..{\emph{increment-value}}\}}} — specify the increment value in a for loop, otherwise the default is 1} \tn % Row Count 3 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{for (( ; ; )); do {\emph{something}} done}} — infinite loop} \tn % Row Count 5 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{break}} — can add to while or for loops to exit from the loop but continue the rest of the script} \tn % Row Count 8 (+ 3) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{continue}} — used to skip current iteration of a loop and continue to the next iteration of the loop} \tn % Row Count 11 (+ 3) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{cut}} — cut different parts of a string} \tn % Row Count 12 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{basename {\emph{path}}}} — get the filename from a given path} \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bash Arrays and Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{{\emph{array}}=({\emph{"elements" "of" "array"}})}} — create an array of strings} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$\{{\emph{array}}{[}0{]}\}}} — get the first element of the array} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$\{{\emph{array}}{[}*{]}\}}} — get all values in the array} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$\{{\emph{array}}{[}-1{]}\}}} — get the last value in the array} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\$\{{\emph{array}}{[}@{]}\}}} — expand all of the array elements} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{declare -A {\emph{associative-array}}}} — declare an associative array that allows string indices, similar to a dictionary in Python} \tn % Row Count 12 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{{\emph{associative-array}}=({[}{\emph{"association"}}{]}={\emph{"string"}})}} — add an association to an associative array} \tn % Row Count 15 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{{\emph{array}}+=({\emph{"new" "elements"}})}} — append elements to the end of an array} \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{shift}} — move argument \$2 to \$1} \tn % Row Count 18 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{{\emph{function()}} \{ {\emph{content-of-function}} \}}} — define a function} \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{alias}} — list all aliases defined in the current session} \tn % Row Count 22 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{alias {\emph{alias}}='{\emph{bash-command }}'}} — define an alias} \tn % Row Count 24 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{type -a {\emph{command}}}} — tells us if command is an alias} \tn % Row Count 26 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Automated Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{man 5 crontab}} — view manual page for crontab} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{crontab -e}} — edit scheduled tasks in the {\emph{/var/spool/cron/crontabs}} file} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{crontab -l}} — list scheduled tasks} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{* * * * * find {\emph{directory}} -exec ls -l \{\} \textbackslash{};}} — find files on {\emph{directory}}} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{* * * * *}} - cron format (0-59 minutes, 0-23 hours, 1-31 day of month, 1-12 month, 0-7 day of week)} \tn % Row Count 9 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 1 1 * * find /temp -atime 3 -exec ls -l \{\} \textbackslash{};}} — run the command just on the first day of each month} \tn % Row Count 12 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 1 * * mon find /temp -atime 3 -exec ls -l \{\} \textbackslash{};}} — run the command once a week on a Monday} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 1 1,15 * * find /temp -atime 3 -exec ls -l \{\} \textbackslash{};}} — run the command on the 1st and 15th day of each month} \tn % Row Count 17 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 1 1-15 * * find /temp -atime 3 -exec ls -l \{\} \textbackslash{};}} — run the command every day from the 1st through the 15th, inclusive} \tn % Row Count 20 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 1 */5 * * find /temp -atime 3 -exec ls -l \{\} \textbackslash{};}} — run the command every fifth dat (1st, 6th, 11th, etc.)} \tn % Row Count 23 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{at}} — reads commands to be executed from a file or from standard input} \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{atq}} — show which commands you have in the {\emph{at}} queue, displays job number, date of planned execution and job owner} \tn % Row Count 28 (+ 3) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{atrm {\emph{job-num}}}} — delete a job from the queue by specifying {\emph{job-num}}} \tn % Row Count 30 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{System}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{\&}} — puts command into the background, allowing you to continue executing other commands} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{du}} — display disk usage statistics} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{df}} — display free disk space} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{free}} — display amount of free and used memory in the system} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{kill}} — get rid of a command in the background} \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{man {\emph{command}}}} — show manual for {\emph{command}}} \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{shutdown now}} — shutdown machine} \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Download and Unpack}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{wget {\emph{file-url}}}} — download a file} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{tar -xzf {\emph{tar-file}}}} — extract a tar file} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Package Management}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{dnf upgrade}} — update the system and all of its packages} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{dnf search {\emph{package-name}}}} — search for new software called {\emph{package-name}}} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{dnf provides {\emph{package-name}}}} — check package name to install} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{dnf install {\emph{package-name}}}} — install new software packages} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{dnf remove {\emph{package-name}}}} — remove a package from the system} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{System Logs}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{who}} — produce information on who is logged in} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{w}} — produce information on who is logged in} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{finger}} — produce information on who is logged in} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{id -u {\emph{username}}}} — get the user ID for a specific user} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl}} — view the log of the entire system} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Q}} — quit from journalctl log} \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl -f}} — follow the logs in real time} \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl -u sshd}} — view only log entries for ssh unit} \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl -u httpd -n 3}} — vie a specific number of log entries (i.e. 3)} \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl \_UID=1000}} — view log entries for a specific user by giving user ID} \tn % Row Count 17 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{journalctl -{}-since "YYYY-MM-DD HH:MM" -{}-until "YYYY-MM-DD HH:MM"}} — filter and display log entries for a certain time period} \tn % Row Count 20 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{dmesg}} — view all kernel messages from the last boot of the machine} \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{last}} — display last user logins} \tn % Row Count 23 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{history}} — list previous commands used} \tn % Row Count 24 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{history | grep {\emph{keyword}}}} — search for a command by {\emph{keyword}} in history} \tn % Row Count 26 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{!{\emph{command-num}}}} — repeat a command from history and run the command} \tn % Row Count 28 (+ 2) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{script}} — record all output for the session in a file} \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{System Logs (cont)}} \tn % Row 17 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{exit}} — exit from scripting session} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Secure Shell}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{ssh}} — gives {\emph{ssh}} command information} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ssh {\emph{username}}@{\emph{ip-address}}}} — log into remote system} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{ssh-keygen}} — generate public/private key pair} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ssh-add}} — command for adding SSH private keys into the SSH authentication agent for implementing single sign-on with SSH} \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{ssh-keyscan}} — for retrieving public keys from servers} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{scp {\emph{file-path}} {\emph{username@ip-address}}:}} — copy a file from your local system to remote system} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{scp {\emph{username@ip-address}}:{\emph{file-path}}}} — copy a file from the remote system to your own system} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{scp -r {\emph{username@ip-address}}:{\emph{directory}}}} — copy a directory from the remote system to your own system} \tn % Row Count 17 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{exit}} — terminate the shell} \tn % Row Count 18 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{\textasciitilde{} + Ctrl-Z}} — suspend the remote login session} \tn % Row Count 20 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{File Searching}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{find}} — search for a file or directory on your file system} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{find /home -name *.jpg}} — find all {\emph{.jpg}} files in the {\emph{/home}} and sub-directories} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{grep {\emph{options}} {\emph{pattern}} {\emph{files}}}} — searches through {\emph{files}} for a particular pattern of characters, and displays all lines that contain that pattern} \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{grep -r {\emph{pattern}} {\emph{dir}}}} — search recursively for pattern in {\emph{dir}}} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{locate {\emph{file}}}} - locate a file} \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Important Directories}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/}} — root directory} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/bin}} — the most essential Unix commands (such as {\emph{ls}})} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/boot}} — location where the kernel and other files used during booting are sometimes stored} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/dev}} — contains device files, the interface between the filesystem and the hardware} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/etc}} — contains configuration files, which can generally be edited by hand in a text editor} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/etc/passwd}} — contains user information in a certain format ({\emph{username}}:{\emph{password}}:{\emph{uid}}:{\emph{gid}}:{\emph{gecos}}:{\emph{homedir}}:{\emph{shell}})} \tn % Row Count 12 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/etc/skel}} — sample startup files you can place in home directories for new users} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/home}} — contains a home folder for each user} \tn % Row Count 15 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/lib}} — contains libraries needed by the essential binaries in the {\emph{/bin}} and {\emph{/sbin}} folder} \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/opt}} — contains subdirectories for optional software packages} \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/proc}} — the interface between the filesystem and the running processes, the CPU and memory} \tn % Row Count 21 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/root}} — the home directory of the root user} \tn % Row Count 22 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/sbin}} — very common commands used by the superuser for system administration} \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/tmp}} — temporary files stored by applications} \tn % Row Count 26 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr}} — contains applications and files used by users} \tn % Row Count 28 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr/bin}} — application/distribution binaries meant to be accessed by locally logged in users} \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Important Directories (cont)}} \tn % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr/sbin}} — application/distribution binaries that support or configure stuff in {\emph{/sbin}}} \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr/include}} — standard location of include files used in C programs (such as {\emph{\textless{}stdio.h\textgreater{}}})} \tn % Row Count 4 (+ 2) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr/src}} — location of sources to programs built on the system} \tn % Row Count 6 (+ 2) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/usr/local}} — programs and data files that have been added locally by the system administrator} \tn % Row Count 8 (+ 2) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{/var}} — administrative files such as log files, used for various utilities} \tn % Row Count 10 (+ 2) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{/var/spool}} — temporary storage for files being printed, sent by UUCP} \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Ownership and Permissions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{sudo}} — log in or run program as root user} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ls -l}} — display ownership and permissions} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{adduser}} — create a user account (as root)} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{passwd {\emph{account}}}} — set password for {\emph{account}} (as root)} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{userdel -r {\emph{account}}}} — delete an account and account's home directory (as root)} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{chown}} — change owner of a file} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{chown {\emph{userid}} /home/{\emph{userid}}/}} — make user account owner of home directory (as root)} \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{chgrp}} — change group} \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{chmod ugo {\emph{file}}}} — change the user, group, and others permissions for {\emph{file}} (ugo given in base 8, where u is the user, g is the group, and o is others)} \tn % Row Count 15 (+ 4) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{chmod {[}ugo{]}{[}+-={]}{[}rwx{]} {\emph{file}}}} — give, take away, or set the read, write, and/or execute permissions for user, group and/or others for {\emph{file}}} \tn % Row Count 18 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{7}} — read, write and execute permissions} \tn % Row Count 19 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{6}} — read and write permissions} \tn % Row Count 20 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{5}} — read and execute permissions} \tn % Row Count 21 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{4}} — read permissions} \tn % Row Count 22 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{3}} — write and execute permissions} \tn % Row Count 23 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{2}} — write permissions} \tn % Row Count 24 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{1}} — execute permissions} \tn % Row Count 25 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{0}} — no permissions} \tn % Row Count 26 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{chmod 644 {\emph{file}}}} — standard permissions for files} \tn % Row Count 28 (+ 2) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{chmod 755 {\emph{dir}}}} — standard permissions for directories} \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Ownership and Permissions (cont)}} \tn % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{find / -user {\emph{username}} -ls}} — find files associated with a user} \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{File Management}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{ls}} — list items in your current directory} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ls -a}} — list all items and hidden files in your current directory} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{ls -l}} — list items, including their size and permissions, in your current directory} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{pwd}} — prints path of current working directory} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{cd}} — change directory to home directory} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{cd {\emph{dir}}}} — change directory to {\emph{dir}}} \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{cd ..}} — go up one directory} \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{cp {\emph{file1}} {\emph{file2}}}} — copy {\emph{file1}} to {\emph{file2}}} \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{cp -r {\emph{dir1}} {\emph{dir2}}}} — copy {\emph{dir1}} to {\emph{dir2}}, recursively} \tn % Row Count 13 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{mv {\emph{file1}} {\emph{file2}}}} — move {\emph{file1}} to {\emph{file2}}, or just change file name} \tn % Row Count 15 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{rm {\emph{file}}}} — remove {\emph{file}}} \tn % Row Count 16 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{rm -r {\emph{dir}}}} — remove directory {\emph{dir}}, recursively} \tn % Row Count 18 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{echo {\emph{text}}}} — outputs {\emph{text}} to standard output} \tn % Row Count 20 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{echo "{\emph{text}}" \textgreater{} {\emph{file}}}} — redirect {\emph{text}} to {\emph{file}}} \tn % Row Count 22 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{touch {\emph{file}}}} — create {\emph{file}}, such as an empty txt or zip} \tn % Row Count 24 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{cat {\emph{file}}}} — concatenate {\emph{file}} and print to standard output} \tn % Row Count 26 (+ 2) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{head {\emph{file}}}} — output first 10 lines of {\emph{file}}} \tn % Row Count 28 (+ 2) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{tail {\emph{file}}}} — output last 10 lines of {\emph{file}}} \tn % Row Count 29 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{less {\emph{file}}}} — view {\emph{file}} instead of opening in an editor, allowing page navigation} \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{File Management (cont)}} \tn % Row 19 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{sort {\emph{file}}}} — used to sort a file, arranging the records in a particular order} \tn % Row Count 2 (+ 2) % Row 20 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ln -S {\emph{target}} {\emph{new-name}}}} — make links between files} \tn % Row Count 4 (+ 2) % Row 21 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{nano {\emph{file}}}} — open {\emph{file}} in nano text editor} \tn % Row Count 6 (+ 2) % Row 22 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{nano -v {\emph{file}}}} — open {\emph{file}} for read only in nano text editor} \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Git Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{git clone {\emph{/path/to/repository}}}} — create a working copy of a local repository} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{git add *}} — add all edited files to staging} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{git add {\emph{filename}}}} — add specific filename to staging} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{git commit -am "{\emph{commit message}}"}} — commit changes to head (but not yet to the remote repository)} \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{git push}} — send changes to the master branch of your remote repository} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{git status}} — list the files you've changed and those you still need to add or commit} \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Miscellaneous}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{yes "{\emph{string}}"}} — echo {\emph{string}} in infinite loop} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{cal}} — prints an ASCII calendar of the given month or year} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{date}} — display current system time} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{true}} — does nothing and finishes with zero exit code, indicating success} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{false}} — does nothing and finishes with non-zero exit code (often 1), indicating failure} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{clear}} — clears the screen of the terminal} \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}