\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{TheMan (GorkemKonuk)} \pdfinfo{ /Title (linux.pdf) /Creator (Cheatography) /Author (TheMan (GorkemKonuk)) /Subject (Linux 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}{A30000} \definecolor{LightBackground}{HTML}{FCF7F7} \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 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{TheMan (GorkemKonuk)} via \textcolor{DarkBackground}{\uline{cheatography.com/218662/cs/48372/}}} \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}TheMan (GorkemKonuk) \\ \uline{cheatography.com/gorkemkonuk} \\ \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 16th August, 2026.\\ 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{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Directory / Navigation}} \tn % Row 0 \SetRowColor{LightBackground} ls & List files and directories \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ls -a & List all files and directories (shows hidden files) \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} ls -l & List files and directories in long format (shows permissions) \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} ls -h & List the sizes in human readable \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} ls -r & Reverse Listing \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} ls -t & Sort by modified time \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} ls -S & Sort by file size (can be used with -r) \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} ls -R & Recursive listing \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} find . & Recursive listing \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} tree & Recursive listing \tn % Row Count 13 (+ 1) % Row 10 \SetRowColor{LightBackground} cd & Change Directory \tn % Row Count 14 (+ 1) % Row 11 \SetRowColor{white} cd .. & Move up one directory \tn % Row Count 15 (+ 1) % Row 12 \SetRowColor{LightBackground} cd ../.. & Move up two directories / or more \tn % Row Count 17 (+ 2) % Row 13 \SetRowColor{white} cd - & Change to previous directory \tn % Row Count 18 (+ 1) % Row 14 \SetRowColor{LightBackground} cd \textasciitilde{} & Change directory to home \tn % Row Count 19 (+ 1) % Row 15 \SetRowColor{white} cd / & Change directory to root directory \tn % Row Count 21 (+ 2) % Row 16 \SetRowColor{LightBackground} pwd & Print working directory \tn % Row Count 22 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Searching}} \tn % Row 0 \SetRowColor{LightBackground} find & Searches the file in current directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} find / -name "file" & Searches the file starting from root directory \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} find / -iname "file" & Searches the file starting from root directory regardless of case sensitivity \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} find -size +100M & See files and directories larger than a specified size in a directory \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} locate & Searches the file in whole disk \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} updatedb & Updates locate's index \tn % Row Count 13 (+ 1) % Row 6 \SetRowColor{LightBackground} grep hello file.txt & Searches the term in a file \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} grep hello *.txt & Searches hello in every .txt file \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} which command & Search the command path in the \$PATH environment variable \tn % Row Count 20 (+ 3) % Row 9 \SetRowColor{white} whereis command & Find the source, binary, and manual page for a command \tn % Row Count 23 (+ 3) \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}{System Management}} \tn % Row 0 \SetRowColor{LightBackground} uname -a & See kernel release information \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} uptime & Display how long the system has been running, including the load average \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} hostname & View system hostname. \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} date & See current time and date \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{timedatectl} & See date and time zone \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} w & List logged-in users. \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} whoami & See which user you are using \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} finger & Show information about a particular use \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} shutdown {[}hh:mm{]} & Schedule a system shutdown \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} shutdown now & Shut down the system immediately \tn % Row Count 16 (+ 2) % Row 10 \SetRowColor{LightBackground} reboot & Restart the OS \tn % Row Count 17 (+ 1) % Row 11 \SetRowColor{white} dmesg & Show bootup messages. \tn % Row Count 18 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Manipulation}} \tn % Row 0 \SetRowColor{LightBackground} cat & Show the contents of the file \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} cat -n & Number all output lines \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} mkdir & Create a new directory \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} mkdir -p dir/dir/dir & Create a dir with child \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} mkdir -p parent/\{child, child2\} & Create a dir with childs \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} mkdir -p parent/\{dir1/\{child1,child2\},dir2 & Create a parent dir with 2 dirs 2 childs \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} rm & Remove a file \tn % Row Count 14 (+ 1) % Row 7 \SetRowColor{white} rm -r & Remove a directory \tn % Row Count 15 (+ 1) % Row 8 \SetRowColor{LightBackground} rm -rf & Remove a directory without confirmation \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} rm -rf . & Remove the current directory \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} cp file file & Copy content of the file to another file \tn % Row Count 21 (+ 2) % Row 11 \SetRowColor{white} cp -r dir dir & Copy content of the dir to another dir \tn % Row Count 23 (+ 2) % Row 12 \SetRowColor{LightBackground} mv file dir & Move or rename file or dirs \tn % Row Count 25 (+ 2) % Row 13 \SetRowColor{white} touch & Create a new file \tn % Row Count 26 (+ 1) % Row 14 \SetRowColor{LightBackground} cat file \textgreater{}\textgreater{}file & Append file contents to another file \tn % Row Count 28 (+ 2) % Row 15 \SetRowColor{white} \textgreater{}file.txt & Truncates the content after ctrl+c. If not pressed and stay in continuation prompt, all input goes to the file like echo \tn % Row Count 34 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Manipulation (cont)}} \tn % Row 16 \SetRowColor{LightBackground} head & Show the first ten lines of a file \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} tail & Show the last ten lines of a file \tn % Row Count 4 (+ 2) % Row 18 \SetRowColor{LightBackground} head/tail -n 5 file & Show the last/first five lines of a file \tn % Row Count 6 (+ 2) % Row 19 \SetRowColor{white} tail -f & Streams the last 10 lines \tn % Row Count 8 (+ 2) % Row 20 \SetRowColor{LightBackground} tail -f -s 2 & Sleep for approximately 2 seconds \tn % Row Count 10 (+ 2) % Row 21 \SetRowColor{white} more & Display contents of a file page by page \tn % Row Count 12 (+ 2) % Row 22 \SetRowColor{LightBackground} less & Show the contents of a file with navigation \tn % Row Count 15 (+ 3) % Row 23 \SetRowColor{white} gpg -c file & Encrypt a file \tn % Row Count 16 (+ 1) % Row 24 \SetRowColor{LightBackground} gpg file.gpg & Decrypt an encrypted .gpg file \tn % Row Count 18 (+ 2) % Row 25 \SetRowColor{white} wc & Shows line, word and byte amount \tn % Row Count 20 (+ 2) % Row 26 \SetRowColor{LightBackground} wc -l & Shows number of lines \tn % Row Count 22 (+ 2) % Row 27 \SetRowColor{white} wc -w & Shows number of words \tn % Row Count 24 (+ 2) % Row 28 \SetRowColor{LightBackground} wc -c & Shows number of bytes (file byte) \tn % Row Count 26 (+ 2) % Row 29 \SetRowColor{white} cut & Learn the usage of this command \tn % Row Count 28 (+ 2) % Row 30 \SetRowColor{LightBackground} shred & Overwrite a file to prevent its recovery \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{File Manipulation (cont)}} \tn % Row 31 \SetRowColor{LightBackground} shred -u & Overwrite a file to prevent its recovery, then delete it \tn % Row Count 3 (+ 3) % Row 32 \SetRowColor{white} shred -n 3 & Overwrite a file 3 times to prevent its recovery \tn % Row Count 6 (+ 3) % Row 33 \SetRowColor{LightBackground} ls | tee list.txt / ls\textgreater{}list.txt | tee & List it and writes the output to list.txt \tn % Row Count 9 (+ 3) % Row 34 \SetRowColor{white} echo "hello" & Prints hello to terminal \tn % Row Count 11 (+ 2) % Row 35 \SetRowColor{LightBackground} echo "hello"\textgreater{} file.txt & Writes hello to the file.txt \tn % Row Count 13 (+ 2) % Row 36 \SetRowColor{white} echo "world"\textgreater{}\textgreater{}file.txt & Adds world to file.txt without removing the file content \tn % Row Count 16 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Processes}} \tn % Row 0 \SetRowColor{LightBackground} ps & List active processes. \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ps aux & List active processes in detail \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} pstree & Show processes in a treelike diagram. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} top & See all running processes. \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} kill PID & Terminate a Linux process under a given ID \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} kill -9 PID & Force terminate a Linux process under a given ID \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} pkill {[}process\_name{]} & Terminate a process under a specific name \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} killall {[}process\_name{]} & Terminate all processes with a given label \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} pidof {[}process\_name{]} & Show the PID of a process. \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}