\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{im\_Tavo (gamejia90)} \pdfinfo{ /Title (basic-bash.pdf) /Creator (Cheatography) /Author (im\_Tavo (gamejia90)) /Subject (Basic Bash 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}{300A24} \definecolor{LightBackground}{HTML}{F8F7F8} \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{Basic Bash Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{im\_Tavo (gamejia90)} via \textcolor{DarkBackground}{\uline{cheatography.com/39342/cs/22361/}}} \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}im\_Tavo (gamejia90) \\ \uline{cheatography.com/gamejia90} \\ \uline{\seqsplit{www}.github.com/Athesto} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 10th April, 2020.\\ Updated 30th May, 2021.\\ 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}{\{\{fa-terminal\}\}Basic Bash}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/gamejia90_1617118226_Bash-logo.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ar\}\}Last Update `2021-06-26` | \{\{link="https://twitter.com/im\_tavo"\}\}\{\{fa-twitter\}\}Im\_tavo\{\{/link\}\} |} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-keyboard-o\}\} Basic Shortcuts}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(TAB)` & \{\{fa-pencil-square-o\}\}{\bf{complete:}} Attempt to perform completion on the text before point. \{\{link="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html\#Commands-For-Completion"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-j)` & {\bf{⏎ accept-line:}} Send a newline (`\textbackslash{}n`) \tn % Row Count 11 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-c)` & \{\{fa-close\}\}{\bf{interrupt (kill):}} The current foreground process running in in the terminal. \{\{link="https://www.howtogeek.com/howto/ubuntu/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 21 (+ 10) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-d)` & \{\{fa-close\}\}{\bf{end-of-file (EOF):}} If {\bf{there are no chars on the line}}, Readline returns \{\{link="https://en.wikipedia.org/wiki/End-of-file"\}\}EOF\{\{/link\}\} \tn % Row Count 28 (+ 7) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-z)` & \{\{fa-low-vision\}\} {\bf{suspend:}} stop the program execution. `fg` to resume, `jobs -l` to list and `kill \textless{}id\textgreater{}` to close it \{\{link="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html\#Job-Control-Basics"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 38 (+ 10) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-keyboard-o\}\} Basic Shortcuts (cont)}} \tn % Row 5 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(M-.)` & \{\{fa-pencil-square-o\}\}{\bf{insert-last-argument :}} Move 'backwards' through the previous aguments \tn % Row Count 4 (+ 4) % Row 6 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-p)` & \{\{fa-search\}\}{\bf{previous-history:}} Move 'backward' through the history list, fetching the previous command. \tn % Row Count 9 (+ 5) % Row 7 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-n)` & \{\{fa-search\}\}{\bf{next-history:}} Move 'forward' through the history list, fetching the next command. \tn % Row Count 14 (+ 5) % Row 8 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-r)` & \{\{fa-search\}\}{\bf{reverse-search-history:}} Search 'backward' through the history. This is an \{\{link="https://en.wikipedia.org/wiki/Incremental\_search"\}\}incremental-search\{\{/link\}\}. \tn % Row Count 22 (+ 8) % Row 9 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-s)` & \{\{fa-search\}\}{\bf{forward-search-history:}} Search 'forward' through the history. Important! You need to disable the xon first to use it (`stty -ixon`) \tn % Row Count 29 (+ 7) % Row 10 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-a)` & \{\{fa-fast-backward\}\} {\bf{beginning-of-line:}} Move to the start of the line. \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-keyboard-o\}\} Basic Shortcuts (cont)}} \tn % Row 11 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-e)` & \{\{fa-fast-forward\}\} {\bf{ending-of-line:}} Move to the end of the line \tn % Row Count 3 (+ 3) % Row 12 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(M-b)` & \{\{fa-long-arrow-left\}\} {\bf{backward-word:}} Move backward a word \tn % Row Count 6 (+ 3) % Row 13 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-b)` & \{\{fa-long-arrow-left\}\} {\bf{backward-char:}} Move backward a character. \tn % Row Count 9 (+ 3) % Row 14 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(M-f)` & \{\{fa-long-arrow-right\}\} {\bf{forward-word:}} Move forward a word \tn % Row Count 12 (+ 3) % Row 15 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-f)` & \{\{fa-long-arrow-right\}\} {\bf{forward-char:}} Move forward a character. \tn % Row Count 15 (+ 3) % Row 16 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-u)` & \{\{fa-cut\}\} {\bf{unix-line-discard:}} Kill 'backward' from the cursor to the beginning of the current line. \tn % Row Count 20 (+ 5) % Row 17 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-k)` & \{\{fa-cut\}\} {\bf{kill-line:}} Kill 'forward' from the cursor to the end of the current line. \tn % Row Count 24 (+ 4) % Row 18 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(M-BS)` & \{\{fa-cut\}\} {\bf{delete-backward-word:}} Kill the word behind point (BS = backspace) \tn % Row Count 28 (+ 4) % Row 19 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(M-d)` & \{\{fa-cut\}\} {\bf{delete-forward-wrord:}} Kill from point to the end of the current word \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-keyboard-o\}\} Basic Shortcuts (cont)}} \tn % Row 20 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-l)` & \{\{fa-eraser\}\}{\bf{clear-screen:}} Clear the screen, reprinting the current line at the top. \tn % Row Count 4 (+ 4) % Row 21 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(C-/)` & \{\{fa-undo\}\}{\bf{undo:}} Incremental undo, separately remembered for each line. \tn % Row Count 8 (+ 4) % Row 22 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-y)` & \{\{fa-paste\}\} {\bf{yank:}} Yank the top of the \{\{link="https://www.gnu.org/software/emacs/manual/html\_node/emacs/Kill-Ring.html"\}\}kill-ring\{\{/link\}\} into the buffer at point. \{\{link="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html\#Readline-Killing-Commands"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 20 (+ 12) % Row 23 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`(M-y)` & \{\{fa-paste\}\} {\bf{yank-pop: }} Rotate the kill-ring, and yank the new top. You can only do this if the prior command is `yank` or `yank-pop`. \tn % Row Count 26 (+ 6) % Row 24 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-s)` & \{\{fa-toggle-off\}\} {\bf{transmit-off (XOFF):}} Stops the data flow from the keyboard \{\{link="https://en.wikipedia.org/wiki/Software\_flow\_control"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-keyboard-o\}\} Basic Shortcuts (cont)}} \tn % Row 25 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`(C-q)` & \{\{fa-toggle-on\}\} {\bf{transmit-on (XON):}} Enable the data flow and release all the info contained \{\{link="https://en.wikipedia.org/wiki/Software\_flow\_control"\}\}{[}more{]}\{\{/link\}\} \tn % Row Count 8 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{`(C-)`: Control key = `Ctrl` \newline `(M-)`: Meta key {[}\{\{fa-windows\}\}{]} = `Alt`, {[}\{\{fa-apple\}\}{]} = `Opt` (check Notes) \newline It is a loose convention that `(C-)` operate on `chars` while `(M-)` operate on `words`. \{\{link="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html\#Readline-Movement-Commands"\}\}{[}more{]}\{\{/link\}\} \newline 'Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-warning\}\} Notes}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{fa-firefox\}\} {\bf{For Firefox users:}} Cheathography uses a preload option to load the icons and firefox disable it by \{\{link="https://caniuse.com/\#feat=link-rel-preload"\}\}default\{\{/link\}\}. To enable it. Write this in the URL bar `about:config`, search the `network.preload` option and set it `true`\{\{nl\}\}You can find more info in this link \{\{link="https://cheatography.com/davechild/cheat-sheets/font-awesome/\#comment30938"\}\}{[}more{]}\{\{/link\}\}} \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{fa-apple\}\} {\bf{For Mac users:}} The `Meta` key is setted to the `ESC`, but you can set the `Opt` key as well. Just open the terminal and go to\{\{nl\}\}`Terminal \textgreater{} Preferences \textgreater{} Basic Default \textgreater{} Keyboard \textgreater{} Use option as meta key`\{\{nl\}\}If you need more information, read this tutorial \{\{link="https://osxdaily.com/2013/02/01/use-option-as-meta-key-in-mac-os-x-terminal/"\}\}{[}more{]}\{\{/link\}\}} \tn % Row Count 17 (+ 8) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{fa-apple\}\} {\bf{Spanish Keyboard Mac users:}} There are some users that say that the configuration of `Opt` key above can disable some keys like `\textbackslash{}\textasciitilde{}\#¬{]}\}\textbackslash{}|`} \tn % Row Count 21 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{fa-windows\}\} {\bf{For Windows user}} There are some ways tu use the bash shortcuts in terminal. if you want to use the native powershell, check this {[}\{\{link="https://gamejia.medium.com/how-to-setup-powershell-with-bash-shortcuts-9f89035bb645"\}\}Article\{\{/link\}\}{]} to see how to use Bash shortcuts} \tn % Row Count 27 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{I really loved doing this cheatsheet, I expect that it could helps you} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-chain\}\} More Info}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{gnu.org: \{\{link="https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html"\}\}Bash Reference Manual\{\{/link\}\}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{ss64.com: \{\{link="https://ss64.com/bash/syntax-keyboard.html"\}\}syntax-keyboard\{\{/link\}\}} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{howtogeek.com : \{\{link="https://www.howtogeek.com/howto/ubuntu/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/"\}\}keyboard-shortcuts...\{\{/link\}\}} \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{catern.com: \{\{link="http://catern.com/posts/terminal\_quirks.html"\}\}Terminals are weird\{\{/link\}\}} \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{catonmat.nrt: \{\{link="https://catonmat.net/bash-emacs-editing-mode-cheat-sheet"\}\}Bash emacs editing mode\{\{/link\}\}} \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{github.com: \{\{link="https://github.com/LeCoupa/awesome-cheatsheets/blob/master/languages/bash.sh"\}\}awesome-cheatsheets\{\{/link\}\}} \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{cheatography.com: \{\{link="https://cheatography.com/gamejia90/cheat-sheets/full-bash/"\}\}Bash shortcuts, full-list\{\{/link\}\}} \tn % Row Count 20 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}