\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{Spec} \pdfinfo{ /Title (sheeeeeeeeeeet.pdf) /Creator (Cheatography) /Author (Spec) /Subject (Sheeeeeeeeeeet 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}{262626} \definecolor{LightBackground}{HTML}{F8F8F8} \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{Sheeeeeeeeeeet Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Spec} via \textcolor{DarkBackground}{\uline{cheatography.com/21500/cs/4158/}}} \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}Spec \\ \uline{cheatography.com/spec} \\ \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 May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{2.38896 cm} x{2.58804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-edit\}\} vim}} \tn % Row 0 \SetRowColor{LightBackground} zo & open folded text \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} zc & close folded text \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} zr & unfold one level \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} zm & fold one level \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} zR & unfold all \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} zM & fold all \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} c-w w & switch window \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} ctrl-w s & split windows \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} c-w v & split vertically \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} c-w q & quit window \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} `:set list` & show characters \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} do & diff obtain \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} dp & diff put \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} `:set diffopt+=iwhite` & avoid whitespace in diff \tn % Row Count 15 (+ 2) % Row 14 \SetRowColor{LightBackground} `:diffu` & refresh differences \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Auto wrap text:}} \newline 1. `:set textwidth=80` \newline 2. select text in visual mode \newline 3. `gq`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.04517 cm} x{3.93183 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-filter\}\} regex}} \tn % Row 0 \SetRowColor{LightBackground} {[}{\bf{\textasciicircum{}}}bg{]} & caret negates expression \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \textbackslash{}s & whitespace \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \textbackslash{}S & not whitespace \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \textbackslash{}d & digit \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \textbackslash{}D & not digi \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \textbackslash{}w & word \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \textbackslash{}x & hexadecimal digit \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \textbackslash{}O & octal digit \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} (?:...) & Passive (non-capturing) group \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.09034 cm} x{2.88666 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-gear\}\} screen}} \tn % Row 0 \SetRowColor{LightBackground} C-a S & split horizontally \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} C-a | or C-a V & split vertically \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} C-a tab & jump to next region \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} C-a X & close region \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4577 cm} x{1.51041 cm} x{2.60889 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-linux\}\} Syslog severity levels}} \tn % Row 0 \SetRowColor{LightBackground} 0 & emerg & Emergency \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 1 & alert & Alert \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} 2 & crit & Critical \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} 3 & err & Error \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} 4 & warning & Warning \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} 5 & notice & Notice \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} 6 & info & Informational \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} 7 & debug & Debug \tn % Row Count 8 (+ 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}{\{\{fa-random\}\} IO redirection}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Output of cmd2 as file input to cmd1:}} \newline % Row Count 1 (+ 1) `cmd1 \textless{}(cmd2)` \newline % Row Count 2 (+ 1) {\bf{Stderr of cmd to file:}} \newline % Row Count 3 (+ 1) `cmd 2\textgreater{} file` \newline % Row Count 4 (+ 1) {\bf{Stdout to same place as stderr:}} \newline % Row Count 5 (+ 1) `cmd 1\textgreater{}\&2` \newline % Row Count 6 (+ 1) {\bf{All output of cmd to file:}} \newline % Row Count 7 (+ 1) `cmd \&\textgreater{} file` \newline % Row Count 8 (+ 1) {\bf{stderr of cmd1 to cmd2:}} \newline % Row Count 9 (+ 1) `cmd1 |\& cmd2`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} DH Groups}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{DH Group 1: 768-bit group \newline % Row Count 1 (+ 1) DH Group 2: 1024-bit group \newline % Row Count 2 (+ 1) DH Group 5: 1536-bit group \newline % Row Count 3 (+ 1) DH Group 14: 2048-bit group \newline % Row Count 4 (+ 1) DH Group 15: 3072-bit group \newline % Row Count 5 (+ 1) DH Group 19: 256-bit elliptic curve group \newline % Row Count 6 (+ 1) DH Group 20: 384-bit elliptic curve group% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{IPsec VPN:}} \newline UDP 500 (IKE includes ISAKMP) \newline UDP 4500 (NAT traversal) \newline IP protocol 50 (ESP) \newline IP protocol 51 (AH)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.44333 cm} x{3.53367 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-sitemap\}\} nmap}} \tn % Row 0 \SetRowColor{LightBackground} -sn & no port scan \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -PE & only ICMP echo for host disc. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} -Pn & no ping \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} -n & no name resolve \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} -p80,443 & scan port 80 and 443 \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} -p- & scan all ports \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} -e {\emph{\textless{}IFACE\textgreater{}}} & use specified interface \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} -O & OS detection \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-sitemap\}\} tcpdump}} \tn % Row 0 \SetRowColor{LightBackground} -A & payload in ASCII \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -c \textless{}count\textgreater{} & exit after {\emph{count}} packets \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} -e & print link level headers \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} -G \textless{}n\textgreater{} & rotate dump file every {\emph{n}} sec \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} -s \textless{}len\textgreater{} & snip first {\emph{len}} bytes per packet \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} -S & absolute TCP seq numbers \tn % Row Count 8 (+ 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}{random}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Backuppaa ACL:t:}} \newline % Row Count 1 (+ 1) `getfacl -pR /joku/hakemisto \textgreater{} permissions.acl` \newline % Row Count 2 (+ 1) `setfacl -{}-restore=permissions.acl` \newline % Row Count 3 (+ 1) {\bf{Listaa ladattavat moduulit:}} \newline % Row Count 4 (+ 1) `cat /lib/modules/\$(uname -r)/modules.dep` \newline % Row Count 5 (+ 1) {\bf{TCP portit:}} \newline % Row Count 6 (+ 1) `0-1023` - well-known ports \newline % Row Count 7 (+ 1) `1024-49151` - registered port \newline % Row Count 8 (+ 1) `49152-65535` - dynamic / private ports \newline % Row Count 9 (+ 1) {\bf{SSL netcat:}} \newline % Row Count 10 (+ 1) `openssl s\_client -connect localhost:995` \newline % Row Count 11 (+ 1) {\bf{Maalaa osumat:}} \newline % Row Count 12 (+ 1) `grep -E -{}-color '(\textasciicircum{}|haku)'` \newline % Row Count 13 (+ 1) {\bf{Unix epoch aika:}} \newline % Row Count 14 (+ 1) `date +\%s` \newline % Row Count 15 (+ 1) `date -d @1268727836`% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-filter\}\} sed: address notation}} \tn % Row 0 \SetRowColor{LightBackground} n & line number \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \$ & last line \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} /regexp/ & lines matching the pattern \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} addr1,addr2 & range of lines \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} 10\textasciitilde{}2 & start `10`, then by `2` intervals \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} addr1,+n & `addr1` and following `n` lines \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} addr! & all lines except `addr` \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{sed -n '{\bf{1,5}}p' file.txt \newline sed '{\bf{1,5}}s/old/new' file.txt} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-filter\}\} sed: editing commands}} \tn % Row 0 \SetRowColor{LightBackground} = & output line number \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} a & append text after line \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} d & delete line \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} p & print line, use -n to override \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{s/old/new/} & substitute \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{`sed "1,10 {\bf{d}}" file.txt` \newline `sed "/snmp/ {\bf{a}} text to append" file.txt` \newline `sed -n "/snmp/ =" file.txt` \newline `sed -i -e '/suodata/\{s/etsi/korvaa/\}' file`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: space split}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{INPUT: "word" "spaces yo"}} \newline \${\emph{ ~~: \$1 = word, \$2 = spaces, ~~~\$3 = yo \newline "\$}}" : \$1 = word spaces yo, \$2 =, \$3 = \newline \$@ ~~: \$1 = word, \$2 = spaces, ~~~\$3 = yo \newline "\$@" : \$1 = word, \$2 = spaces yo, \$3 =} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: for in C Form}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{for (( i=0; i\textless{}5; i=i+1 )); do \newline ~~echo \$i \newline done} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: variable expansions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Return {\emph{\$parameter}} or "{\emph{word}}" if empty:}} \newline % Row Count 1 (+ 1) `\$\{parameter:-word\}` \newline % Row Count 2 (+ 1) {\bf{Previous + set variable value if it's unset:}} \newline % Row Count 3 (+ 1) `\$\{parameter:=word\}` \newline % Row Count 4 (+ 1) {\bf{Exit script with {\emph{error message}} if empty:}} \newline % Row Count 5 (+ 1) `\$\{parameter:?error message\}` \newline % Row Count 6 (+ 1) {\bf{Results nothing if empty. If not empty, substitute and don't change variable value:}} \newline % Row Count 8 (+ 2) `\$\{parameter:+word\}` \newline % Row Count 9 (+ 1) {\bf{Return variable names:}} \newline % Row Count 10 (+ 1) `\$\{!prefix*\}` \newline % Row Count 11 (+ 1) {\bf{Return string length:}} \newline % Row Count 12 (+ 1) `\$\{\#parameter\}` \newline % Row Count 13 (+ 1) {\bf{Return substring:}} \newline % Row Count 14 (+ 1) `\$\{parameter:offset\}` \newline % Row Count 15 (+ 1) `\$\{parameter:offset:length\}` \newline % Row Count 16 (+ 1) {\bf{Remove leading substring:}} \newline % Row Count 17 (+ 1) `\$\{parameter\#pattern\}` {\emph{(shortest match)}} \newline % Row Count 18 (+ 1) `\$\{parameter\#\#pattern\}` {\emph{(longest match)}} \newline % Row Count 19 (+ 1) {\bf{Remove trailing substring:}} \newline % Row Count 20 (+ 1) `\$\{parameter\%pattern\}` {\emph{(shortest match)}} \newline % Row Count 21 (+ 1) `\$\{parameter\%\%pattern\}` {\emph{(longest match)}} \newline % Row Count 22 (+ 1) {\bf{Search and replace. If string not set, delete matched text.}} \newline % Row Count 24 (+ 2) {\bf{Only first occurence:}} \newline % Row Count 25 (+ 1) `\$\{parameter/pattern/string\}` \newline % Row Count 26 (+ 1) {\bf{All occurences:}} \newline % Row Count 27 (+ 1) `\$\{parameter//pattern/string\}` \newline % Row Count 28 (+ 1) {\bf{Match required at the beginning of string:}} \newline % Row Count 29 (+ 1) `\$\{parameter/\#pattern/string\}` \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: variable expansions (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Match required at the end of string:}} \newline % Row Count 1 (+ 1) `\$\{parameter/\%pattern/string\}`% Row Count 2 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.38896 cm} x{2.58804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: number bases}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{number}} & base 10 integer \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 0{\bf{number}} & base 8 octal \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} 0x{\bf{number}} & base 16 hexadecimal \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{base}}\#{\bf{number}} & {\emph{number}} is in {\emph{base}} \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{`echo \$((0xff))` \newline \{\{fa-caret-right\}\} 255 \newline `echo \$((2\#11111111))` \newline \{\{fa-caret-right\}\} 255} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: ternary operator}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{expr1}}?{\bf{expr2}}:{\bf{expr3}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{If expression {\bf{{\emph{expr1}}}} evaluates to be non-zero (arithmetic true) then {\bf{{\emph{expr2}}}}, else {\bf{{\emph{expr3}}}}.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.84149 cm} x{3.13551 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-code\}\} Bash: case conversion}} \tn % Row 0 \SetRowColor{LightBackground} \$\{parameter,,\} & All to lowercase. \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \$\{parameter,\} & First char to lowercase. \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \$\{parameter\textasciicircum{}\textasciicircum{}\} & All to uppercase. \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \$\{parameter\textasciicircum{}\} & First char to uppercase. \tn % Row Count 4 (+ 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}{\{\{fa-code\}\} Bash: tests}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Pattern matching:}} \newline % Row Count 1 (+ 1) `{[}{[} "foo.bar" == foo.* {]}{]}` \newline % Row Count 2 (+ 1) {\bf{Regexp:}} \newline % Row Count 3 (+ 1) `{[}{[} "\$INT" =\textasciitilde{} \textasciicircum{}-?{[}0-9{]}+\$ {]}{]}` \newline % Row Count 4 (+ 1) {\bf{Arithmetic truth tests:}} \newline % Row Count 5 (+ 1) `(( ((INT \% 2)) == 0))`% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}