\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{culebrinoo} \pdfinfo{ /Title (linux-cheatsheet.pdf) /Creator (Cheatography) /Author (culebrinoo) /Subject (Linux cheatsheet 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}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \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 cheatsheet Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{culebrinoo} via \textcolor{DarkBackground}{\uline{cheatography.com/122227/cs/22624/}}} \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}culebrinoo \\ \uline{cheatography.com/culebrinoo} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 4th May, 2020.\\ Updated 4th May, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{3.43413 cm} x{1.54287 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Expansion}} \tn % Row 0 \SetRowColor{LightBackground} `ls {\bf{\$(}}which cp{\bf{)}}`\{\{nl\}\}`ls {\bf{\textbackslash{}`}}which cp{\bf{\textbackslash{}`}}` & Command expansion \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `mkdir \{2017...2020\}-\{01-12\}` & Brace expansion \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} `echo text \textasciitilde{}/*.txt \{a,b\} \$USER` & Variable expansion \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} `echo "text \textasciitilde{}/*.txt \{a,b\} \$USER"` & " expansion \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} `echo 'text \textasciitilde{}/*.txt \{a,b\} \$USER'` & ' expansion (NONE) \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.03597 cm} x{1.94103 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Redirection \& Commands}} \tn % Row 0 \SetRowColor{LightBackground} `ls {\bf{\textgreater{}}} file.txt` & Standard Out \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `ls {\bf{2\textgreater{}}} file.txt` & Standard Error \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `ls {\bf{\textgreater{}}} file.txt {\bf{2\textgreater{}\&1}}`\{\{nl\}\}`ls {\bf{\&\textgreater{}}} file.txt` & Standard Out \& Error \tn % Row Count 5 (+ 3) % Row 3 \SetRowColor{white} `ls | {\bf{tee}} file | wc -l` & Read stdin \& writes stdout \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} `cmd1 ; cmd2` & Run cmd1 then cmd2 \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} `cmd1 \&\& cmd2` & Run cmd2 if cmd1 is OK \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} `cmd1 || cmd2` & Run cmd2 if cmd1 is KO \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{su / sudo}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`su {[}-{[}l{]}{]} {[}user{]}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Become another user, `ROOT` by default. If `-` or `-l`, load user envs and working dir.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`su {[}user{]} -c 'command'`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Execute command as user. Default `root`} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`sudo {[}-u user{]} command`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Execute command as user. Default `root`} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`sudo -ll`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Which commands I'm allowed to execute} \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`visudo`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Edit `/etc/sudoers` file. Example \{\{nl\}\} `teralco ALL=(root) NOPASSWD: /etc/init.d/jboss` \{\{nl\}\} `teralco ALL=(jboss) NOPASSWD: /bin/kill`} \tn % Row Count 13 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{UFW}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw}} {\bf{status}} {[}{\emph{verbose}}|{\emph{numbered}}{]}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Show status and rules} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw default}} deny incoming`\{\{nl\}\}`{\bf{ufw default}} allow outgoing`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Deny all incoming traffic by default\{\{nl\}\}Allow all outgoing traffic by default} \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw}} {[}{\emph{allow}}|{\emph{deny}}{]} {\bf{from}} IP {\bf{to}} {[}any|interface\_name{]} {[}{\bf{proto}} tcp|udp{]} {\bf{port}} PORT`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Full allow/deny rule} \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw}} {[}{\emph{allow}}|{\emph{deny}}{]} {\emph{service\_name}}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Allow/deny a service (`ssh www ftp ...`)} \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw}} {[}{\emph{enable}}|{\emph{disable}}{]}`} \tn % Row Count 12 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ufw}} {\bf{delete}} {[}{\emph{rule}}|{\emph{number}}{]}`} \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Alt commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`/var/log/messages \& /var/log/syslog`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}System log files} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{script}} file`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Record session commands in file} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{nohup}} command \&`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Keep command running even after close session} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{tar -J}}xvf file.tar.xz {[}-C dest\_folder{]}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Extract xz (higher compress ratio)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`zip -FF x.zip -{}-out Y.zip \&\& unzip Y.zip`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Merge zip files (x.zip, x.z01, x.z02)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`ps aux -{}-sort -rss`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Higher memory consumption processes} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`fdisk -l`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}List partition tables} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`dd bs=4M if=input.iso of=/dev/sd? conv=fdatasync`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Burn iso in device} \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Searches}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{find}} path {\emph{-name}} *.log {\emph{-type}} f {\emph{-mtime}} +5 {\emph{-exec}} rm -rvf \{\} \textbackslash{};`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Find and delete files older than 5 days} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{find}} path {\emph{-type}} f {\emph{-printf}} "\%s\textbackslash{}t\%p\textbackslash{}n" | {\bf{sort}} {\emph{-rn}} | {\bf{head}} {\emph{-10}}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Find the 10 biggest files} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{grep}} {\emph{-rlie}} 'pattern' path`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Find files with pattern content} \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{du}} {\emph{-cks}} path/* | {\bf{sort}} {\emph{-rn}} | {\bf{head}} {\emph{-10}}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Find biggest dirs} \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{du}} {\emph{-sh}} path`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Dir size} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Permissions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{chmod}} {[}u|g|o{]}{[}+|-|={]}{[}rwx{]} dir\_file`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Change permissions} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`chmod {\bf{u{[}+|-{]}s}} file`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Set uid. File is always exec as owner user} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`chmod {\bf{g{[}+|-{]}s}} dir`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Set gid. New files in folder are always owned by folder owner} \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`chmod {\bf{{[}+|-{]}t}} dir`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Sticky Bit. Files in dir can only be renamed or removed by owner or root} \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{umask}} xxxx`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Set default permissions to dirs} \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Enviroment}} \tn % Row 0 \SetRowColor{LightBackground} `/etc/profile\{\{nl\}\}/etc/bash.bashrc` & Global env config files \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `\textasciitilde{}/.bashrc\{\{nl\}\}\textasciitilde{}/.profile` & User env config file \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} `printenv` & Print defined env vars \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} `alias` & Show defined aliases \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} `export VAR` & Make a VAR available to child process \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} `{\bf{source}} script`\{\{nl\}\}`{\bf{.}} script` & Load a file into current script or shell session \tn % Row Count 12 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Network}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ip}} addr`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Show ips} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ifup}}|{\bf{ifdown}} {\emph{interface\_name}}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Up or down an interface} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\seqsplit{`/etc/network/interfaces`}} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}File interfaces are defined} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{hostnamectl}} {[}set-hostname {\emph{hostname}}{]}`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Manage hostname (`/etc/hostname`) without restarting} \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{netstat}} -tuln`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All tcp and udp listening ports} \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ss}} -tuln`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All tcp and udp listening ports} \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{nc}} {\emph{-vz}} host port`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Scan port in host} \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{SSH}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh-keygen}} {[}-f /etc/ssh/ssh\_host\_rsa\_key{]} -t rsa -b 4096`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Generate ssh rsa key. By default `\textasciitilde{}/.ssh/id\_rsa`} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh-copy-id}} {[}-i \textasciitilde{}/.ssh/mykey{]} user@host`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Copy ssh key in remote host (`\textasciitilde{}/.ssh/authorized\_keys`). By default `\textasciitilde{}/.ssh/id\_rsa`.} \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh}} user@host command`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Exec command in host} \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh}} {\emph{-J}} hostA hostB`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Connect to hostB through hostA (Jumping). Identification in localhost. Can use `{\bf{ProxyJump}}` in `\textasciitilde{}/.ssh/config`} \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh}} {\emph{-D}} port {\emph{-fCqN}} user@host`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Proxy socket (HTTP and HTTPS traffic) through port.} \tn % Row Count 16 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh}} {\emph{-nNT -L}} 9000:remote\_server:80 user@host`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Tunneling (Local port forwarding). Map `remote\_server:80` into `localhost:9000` through host} \tn % Row Count 20 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`{\bf{ssh}} {\emph{-nNT -R}} 9000:localhost:3000 user@host`} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Tunneling (Remote port forwarding). Map `localhost:3000` into `host:9000`} \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}