\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{chrissoper1} \pdfinfo{ /Title (bash-script-colors.pdf) /Creator (Cheatography) /Author (chrissoper1) /Subject (Bash Script Colors 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}{3A6E85} \definecolor{LightBackground}{HTML}{F2F5F7} \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{Bash Script Colors Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{chrissoper1} via \textcolor{DarkBackground}{\uline{cheatography.com/24894/cs/8483/}}} \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}chrissoper1 \\ \uline{cheatography.com/chrissoper1} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 22nd June, 2016.\\ Updated 22nd June, 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}{p{0.69678 cm} x{4.28022 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{TPUT Control Codes}} \tn % Row 0 \SetRowColor{LightBackground} setf & Foreground color (text) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} setaf & Foreground color (ANSI escaped) \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} setb & Background color \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} setab & Background color (ANSI escaped) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} bold & Brighten all colors \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} dim & Darken all colors \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} rev & Reverse color pallete \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} smul & Begin underlining \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} rmul & Stop underlining \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} smso & Enter Standout Mode \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} rmso & Exit Standout Mode \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} smcup & Clear \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} clear & Clear \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} reset & Reset Screen Size \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} rmcup & Restore \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} sgr0 & Revert all attribute changes \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Usage: tput \textless{}control\textgreater{} {[}color{]}}} \newline Red Hello: \newline `tput setaf 1;echo "Hello";tput sgr0` \newline Light Green ps: \newline `tput setaf 2;tput bold;ps;tput sgr0`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.4793 cm} p{0.4977 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{TPUT Color Codes}} \tn % Row 0 \SetRowColor{LightBackground} Black & 0 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Red & 1 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Green & 2 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Yellow & 3 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Blue & 4 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} Magenta & 5 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} Cyan & 6 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} Light Grey & 7 \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.08114 cm} x{0.89586 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{LS\_COLORS File Codes}} \tn % Row 0 \SetRowColor{LightBackground} Block Device (buffered) & bd \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} File with Capability & ca \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Character Device (unbuffered) & cd \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Directory & di \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Door & do \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} End Code & ec \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} Executable File & ex \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} File & fi \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} Left Code & lc \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} Symbolic Link & ln \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} Multi Hard Link\{\{nl\}\}(File with more than one link) & mh \tn % Row Count 12 (+ 2) % Row 11 \SetRowColor{white} Missing File\{\{nl\}\}(Pointed to by a symlink) & mi \tn % Row Count 14 (+ 2) % Row 12 \SetRowColor{LightBackground} Orphaned Symbolic Link\{\{nl\}\}(Points to a missing file) & or \tn % Row Count 16 (+ 2) % Row 13 \SetRowColor{white} Other-Writable Directory & ow \tn % Row Count 17 (+ 1) % Row 14 \SetRowColor{LightBackground} Named Pipe & pi \tn % Row Count 18 (+ 1) % Row 15 \SetRowColor{white} Right Code & rc \tn % Row Count 19 (+ 1) % Row 16 \SetRowColor{LightBackground} Socket File & so \tn % Row Count 20 (+ 1) % Row 17 \SetRowColor{white} Directory Sticky (+t) & st \tn % Row Count 21 (+ 1) % Row 18 \SetRowColor{LightBackground} File setuid (u+s) & su \tn % Row Count 22 (+ 1) % Row 19 \SetRowColor{white} Sticky AND Other-Writable & tw \tn % Row Count 23 (+ 1) % Row 20 \SetRowColor{LightBackground} File Extension Specific & \seqsplit{*.example} \tn % Row Count 25 (+ 2) % Row 21 \SetRowColor{white} & \seqsplit{.example} \tn % Row Count 27 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Create a dircolors file with `dircolors -p \textgreater{} \textasciitilde{}/.dircolors`\{\{nl\}\}see dir\_colors(1), dir\_colors(5) for more info} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{4.4793 cm} p{0.4977 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ANSI Control Codes}} \tn % Row 0 \SetRowColor{LightBackground} Reset & 0 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Bold & 1 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Dim & 2 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Underline on & 4 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Underline off & 24 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} Blink start & 5 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} Blink end & 25 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} Inverse pallete start & 7 \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} Inverse pallete end & 27 \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} Conceal & 8 \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} Normal & 22 \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{see console\_codes(4) for more information} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.41887 cm} x{1.14425 cm} x{2.01388 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{ANSI Color Codes}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Color}} & {\bf{Text}} & {\bf{Background}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Black & 30 & 40 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Red & 31 & 41 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Green & 32 & 42 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Yellow & 33 & 43 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} Blue & 34 & 44 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} Magenta & 35 & 45 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} Cyan & 36 & 46 \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} Light Grey & 37 & 47 \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}