\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{ralema56} \pdfinfo{ /Title (linux-commands.pdf) /Creator (Cheatography) /Author (ralema56) /Subject (Linux Commands 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}{4774A1} \definecolor{LightBackground}{HTML}{F3F6F9} \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 Commands Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ralema56} via \textcolor{DarkBackground}{\uline{cheatography.com/78049/cs/19072/}}} \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}ralema56 \\ \uline{cheatography.com/ralema56} \\ \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 15th March, 2019.\\ 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.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Quick basic commands}} \tn % Row 0 \SetRowColor{LightBackground} cd (Example: cd Desktop) & change directory, case sensitive \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} cd & home directory \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} . & this directory \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} cd .. & go up one directory \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} cd - & change dir to previous working dir \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} pwd & print working directory \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} ls & list contents, -a all, -h human readable \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} ll & LL list directories with RW permissions \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} la & LA list all including hidden \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} sudo & super user privileges \tn % Row Count 16 (+ 1) % Row 10 \SetRowColor{LightBackground} mkdir \textless{}dirname\textgreater{} \textless{}dirname2\textgreater{} & create directories \tn % Row Count 18 (+ 2) % Row 11 \SetRowColor{white} cp \textless{}path and locations\textgreater{} . & copy contents to current directory, cp by itself will overwrite files silently \tn % Row Count 22 (+ 4) % Row 12 \SetRowColor{LightBackground} mv \textless{}item1\textgreater{} \textless{}item2\textgreater{} directory & move file(s) to location \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} rm -i \textless{}item\textgreater{} & delete file, -i interactive confirmation \tn % Row Count 26 (+ 2) % Row 14 \SetRowColor{LightBackground} alias & lists alias commands \tn % Row Count 27 (+ 1) % Row 15 \SetRowColor{white} alert \textless{}"message"\textgreater{} & sends a message to notifications \tn % Row Count 29 (+ 2) % Row 16 \SetRowColor{LightBackground} \textgreater{} emptyDOC.txt & make an empty text file \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Quick basic commands (cont)}} \tn % Row 17 \SetRowColor{LightBackground} \textgreater{} & standard out to .txt (will overwrite) \tn % Row Count 2 (+ 2) % Row 18 \SetRowColor{white} \textgreater{}\textgreater{} & append standard out .txt will (not overwrite) \tn % Row Count 5 (+ 3) % Row 19 \SetRowColor{LightBackground} ls -la /usr/bin \textgreater{} ls-output.txt & will print the directory contents to a text file \tn % Row Count 8 (+ 3) % Row 20 \SetRowColor{white} \&\textgreater{} & will include output and errors \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{apt}} \tn % Row 0 \SetRowColor{LightBackground} apt list & | grep Type a word to highlight in red \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} apt search & | grep searchword \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} apt install & app name \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} apt remove & app name \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{apt update} \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{apt upgrade} \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Permissions}} \tn % Row 0 \SetRowColor{LightBackground} id & Display user idenity \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} chmod & Change a files mode \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} umask & Set the default file permissions \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} su & Run a shell as another user \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} sudo & Execute a command as another user \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} chown & Change a file's owner \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} chgrp & Change a file's group ownership \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \seqsplit{passwd} & Change a user's password \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Reading, Writing, Executing -rw-r-{}-r-{}-}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Example} & -rw-r-{}-r-{}- \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} - & col1. Regular file \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} d & col1. Directory \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} l & col1. A symbolic link. Dummy values. \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} c & col1. A charcater special file. Modem \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} b & col1. A block special file. Ex. CD, HDD. \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} r & Read only \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} w & Write \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} x & Executable \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.59264 cm} x{3.38436 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{iptables (firewall)}} \tn % Row 0 \SetRowColor{LightBackground} iptables -h & list commands \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -{}-list & list the rule in a chain or all chains \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} -{}-verbose or -v & details \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} -{}-line-numbers & print line numbers when listing \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} -{}-version or -V & version number \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} -{}-list-rules or -S & list rules \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} -{}-numeric or -n & numeric output of addresses and ports \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Permission Attribute Examples}} \tn % Row 0 \SetRowColor{LightBackground} -rwx-{}-{}-{}-{}-{}- & read, write, execute by file's owner only \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -rw-{}-{}-{}-{}-{}-{}- & read and write by owner only \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} -rw-r-{}-r-{}- & read and write owner, read group, read world \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{-rwxr-xr-x} & read, write, execute owner. read and execute everyone else. \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{lrwxrwxrwx} & A symbolic link with dummy permissions \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} drwxr-x-{}-{}- & Directory. read, write, execute owner. Read and execute group. \tn % Row Count 12 (+ 2) \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}{Changing passwords}} \tn % Row 0 \SetRowColor{LightBackground} passwd {[}user{]} & with sudo you can change a user password \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} passwd & change your password \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.14011 cm} x{2.83689 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{chown}} \tn % Row 0 \SetRowColor{LightBackground} chown {[}owner{]}{[}:{[}group{]}{]} file.. & syntax use \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} bob & change ownership from current to bob \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} bob:users & change file ownership to bob and group to users \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} :admins & change group owner to admins, the owner is unchanged \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} bob: & change the current owner to bob and change the group to the login group for bob \tn % Row Count 14 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{text editors}} \tn % Row 0 \SetRowColor{LightBackground} gedit & GUI (installed in Ubuntu) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} kedit & KDE default \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} kate & sudo apt install kate \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} nano & command line based (installed in Ubuntu) \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} vi or vim & vi IMproved (installed in Ubuntu) \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} emacs & sudo apt install emacs-gtk \tn % Row Count 8 (+ 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}{text editing basics}} \tn % Row 0 \SetRowColor{LightBackground} make a backup before editing & cp \textless{}filename\textgreater{} \textless{}filename.bak\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} nano \textless{}filename\textgreater{} & load a text in nano \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{nano text editor}} \tn % Row 0 \SetRowColor{LightBackground} \textasciicircum{}X & to quit nano, \textasciicircum{} mean CTRL \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textasciicircum{}O CTRL-O & save the file \tn % Row Count 2 (+ 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}{vi or vim text editor}} \tn % Row 0 \SetRowColor{LightBackground} vi & start vim \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} vi newdoc.txt & create a blank text doc in vi from command line \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} :q & quit \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} :q! & quit without saving \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} vi starts in command mode & press i to go to insert text mode \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} press ESC to exit insert mode & exit insert mode with ESC \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} :w & save the file, or write to file \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{double tap ESC if you don't know where you are in vi} \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Navigating Command Mode}}} \tn % Row Count 15 (+ 1) % Row 9 \SetRowColor{white} H or left arrow & left one character \tn % Row Count 16 (+ 1) % Row 10 \SetRowColor{LightBackground} J or down arrow & down one line \tn % Row Count 17 (+ 1) % Row 11 \SetRowColor{white} K or up arrow & up one line \tn % Row Count 18 (+ 1) % Row 12 \SetRowColor{LightBackground} L or right arrow & right one character \tn % Row Count 19 (+ 1) % Row 13 \SetRowColor{white} 0 (zero) & go to the beginning of the current line \tn % Row Count 21 (+ 2) % Row 14 \SetRowColor{LightBackground} SHIFT-6 (\textasciicircum{}) & to the first non whitespace character on the current line \tn % Row Count 24 (+ 3) % Row 15 \SetRowColor{white} SHIFT-4 (\$) & to the end on the current line \tn % Row Count 26 (+ 2) % Row 16 \SetRowColor{LightBackground} W & to the beginning of the next word, or punctuation characters \tn % Row Count 29 (+ 3) % Row 17 \SetRowColor{white} SHIFT-W (W) & to the beginning of the next word, ignore punctuation characters \tn % Row Count 33 (+ 4) \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}{vi or vim text editor (cont)}} \tn % Row 18 \SetRowColor{LightBackground} B & to the beginning of the previous word or character \tn % Row Count 3 (+ 3) % Row 19 \SetRowColor{white} SHIFT B (B) & to the beginning of the previous word or character, ignoring punctuation \tn % Row Count 7 (+ 4) % Row 20 \SetRowColor{LightBackground} CTRL-F or page down & down on page \tn % Row Count 8 (+ 1) % Row 21 \SetRowColor{white} CTRL-B or page up & up one page \tn % Row Count 9 (+ 1) % Row 22 \SetRowColor{LightBackground} number-SHIFT-G & to the line number, example 1G moves to the first line of the file \tn % Row Count 13 (+ 4) % Row 23 \SetRowColor{white} SHIFT-G & to the last line of the file \tn % Row Count 15 (+ 2) % Row 24 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Cutting, Copying, Pasting Text}}} \tn % Row Count 16 (+ 1) % Row 25 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{DELETE TEXT aka CUT TEXT}}} \tn % Row Count 17 (+ 1) % Row 26 \SetRowColor{LightBackground} x & delete the current character \tn % Row Count 19 (+ 2) % Row 27 \SetRowColor{white} 3x & delete the current character and the 2 after it \tn % Row Count 22 (+ 3) % Row 28 \SetRowColor{LightBackground} dd & delete the current line \tn % Row Count 24 (+ 2) % Row 29 \SetRowColor{white} 5dd & delete the current line and the next 4 lines \tn % Row Count 27 (+ 3) % Row 30 \SetRowColor{LightBackground} dW & delete from the current cursor position to the beginning of the next word \tn % Row Count 31 (+ 4) \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}{vi or vim text editor (cont)}} \tn % Row 31 \SetRowColor{LightBackground} d\$ & delete from the current cursor position to the end of the line \tn % Row Count 4 (+ 4) % Row 32 \SetRowColor{white} d0 & delete from the current cursor position to the beginning of the line \tn % Row Count 8 (+ 4) % Row 33 \SetRowColor{LightBackground} d\textasciicircum{} & delete from the current cursor location to the first non whitespace character line \tn % Row Count 13 (+ 5) % Row 34 \SetRowColor{white} dG & from the current line to the end of the file \tn % Row Count 16 (+ 3) % Row 35 \SetRowColor{LightBackground} d20g & from the current line to the 20th line of the file \tn % Row Count 19 (+ 3) % Row 36 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{COPYING}}} \tn % Row Count 20 (+ 1) % Row 37 \SetRowColor{LightBackground} yy & y stands for yank which is copy, yy copies the current line \tn % Row Count 23 (+ 3) % Row 38 \SetRowColor{white} 5yy & copies the current line and the next 4 lines \tn % Row Count 26 (+ 3) % Row 39 \SetRowColor{LightBackground} yW & from the cursor location to the beginning of the next word \tn % Row Count 29 (+ 3) % Row 40 \SetRowColor{white} y\$ & from the cursor location to the end of the current line \tn % Row Count 32 (+ 3) \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}{vi or vim text editor (cont)}} \tn % Row 41 \SetRowColor{LightBackground} y0 & from the current cursor location to the beginning of the line \tn % Row Count 4 (+ 4) % Row 42 \SetRowColor{white} y\textasciicircum{} & from the current cursor location to the first non whitespace character in line \tn % Row Count 8 (+ 4) % Row 43 \SetRowColor{LightBackground} yG & from the current line to the end of the file \tn % Row Count 11 (+ 3) % Row 44 \SetRowColor{white} y20G & from the current line to the 20th line of the file \tn % Row Count 14 (+ 3) % Row 45 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{PASTING}}} \tn % Row Count 15 (+ 1) % Row 46 \SetRowColor{white} p & pastes the current copied text below the current line \tn % Row Count 18 (+ 3) % Row 47 \SetRowColor{LightBackground} P & pastes the copied text above the current line \tn % Row Count 21 (+ 3) % Row 48 \SetRowColor{white} Join lines & J \tn % Row Count 22 (+ 1) % Row 49 \SetRowColor{LightBackground} vi has the ability to do search and replace & maybe I will add a cheat sheet for this later \tn % Row Count 25 (+ 3) % Row 50 \SetRowColor{white} /searchtext & searches vi \tn % Row Count 26 (+ 1) % Row 51 \SetRowColor{LightBackground} :\%s/Line/line/g & will search and replace Line with line globally \tn % Row Count 29 (+ 3) % Row 52 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{EDIT MULTIPLE FILES}}} \tn % Row Count 30 (+ 1) \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}{vi or vim text editor (cont)}} \tn % Row 53 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{vi file1 file2 file3} \tn % Row Count 1 (+ 1) % Row 54 \SetRowColor{white} :n & switch to the next file \tn % Row Count 3 (+ 2) % Row 55 \SetRowColor{LightBackground} :N & switch to the previous file \tn % Row Count 5 (+ 2) % Row 56 \SetRowColor{white} :buffers & lists open files \tn % Row Count 6 (+ 1) % Row 57 \SetRowColor{LightBackground} :buffers 2 & switch to buffer file 2 \tn % Row Count 8 (+ 2) % Row 58 \SetRowColor{white} :e & open another file from vi. example :e filename.txt \tn % Row Count 11 (+ 3) % Row 59 \SetRowColor{LightBackground} :r & copy an entire file to the vi session. example :r myfile.txt \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Networking commands}} \tn % Row 0 \SetRowColor{LightBackground} ping & send en ICMP echo request to network hosts \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{traceroute} & print the route packets trace to a network host \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} netstat & print the network connections, routing tables, interface stats, masquerade connections, and multi cast memberships \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} ftp & file transfer program \tn % Row Count 9 (+ 1) % Row 4 \SetRowColor{LightBackground} lftp & an improved ftp \tn % Row Count 10 (+ 1) % Row 5 \SetRowColor{white} wget & non interactive network downloader \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} ssh & openSSH SSH client (remote login) \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} scp & secure copy (remote copy program) \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} sftp & secure ftp \tn % Row Count 17 (+ 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}{Technical commands}} \tn % Row 0 \SetRowColor{LightBackground} cat (brings files together, uses input) & CTRL-D to quit, tell cat EOF \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} cat \textgreater{} sometext.txt; this is some text to be saved & a simple way to add text to a text file \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} cat sometext.txt & to read the file with cat \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} | & pipe connects input to output \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} ls /bin /usr/bin |sort | less & example sort 2 dirs binaries \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} sort & alphabetize a list \tn % Row Count 12 (+ 1) % Row 6 \SetRowColor{LightBackground} uniq & used with sort, removes duplicates \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} grep & pattern finding \tn % Row Count 15 (+ 1) % Row 8 \SetRowColor{LightBackground} head & checks the first 10 lines of a file. -n \# (to adjust \#) \tn % Row Count 18 (+ 3) % Row 9 \SetRowColor{white} tail & checks the last 10 lines of a file. -n\# \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} tail -f /var/log/messages & -f is a real time log file viewer switch(CTRL-C to quit) \tn % Row Count 23 (+ 3) % Row 11 \SetRowColor{white} tee & for use with pipe \tn % Row Count 24 (+ 1) % Row 12 \SetRowColor{LightBackground} echo *D & display everything with a capital D \tn % Row Count 26 (+ 2) % Row 13 \SetRowColor{white} echo \$((2+2)) & command line calculator \tn % Row Count 28 (+ 2) % Row 14 \SetRowColor{LightBackground} echo "\$(cal)" & calendar \tn % Row Count 29 (+ 1) % Row 15 \SetRowColor{white} history & a list of all commands used \tn % Row Count 31 (+ 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}{Technical commands (cont)}} \tn % Row 16 \SetRowColor{LightBackground} history: !88 & !88 will use number 88 in history \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.79632 cm} x{4.18068 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{USB checking}} \tn % Row 0 \SetRowColor{LightBackground} lsusb & list connected USB devices \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.68758 cm} x{2.28942 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{dpkg}} \tn % Row 0 \SetRowColor{LightBackground} dpkg -{}-list & list all installed packages \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -r or -{}-remove & remove a package \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{-P or -{}-purge} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} -{}-log=\textless{}filename\textgreater{} & log changes made \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} -i or -{}-install \textless{}.deb file name\textgreater{} & install a deb file \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{chmod octal chart}} \tn % Row 0 \SetRowColor{LightBackground} octal & binary - filemode \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 0 & 000 -{}-{}- \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} 1 & 001 -{}-x \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} 2 & 010 -w- \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} 3 & 011 -wx \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} 4 & 100 r-{}- \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} 5 & 101 r-x \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} 6 & 110 rw- \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} 7 & 111 rwx \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} example setting octal 600 & owner, group, world \tn % Row Count 11 (+ 2) % Row 10 \SetRowColor{LightBackground} & binary seems somewhat irrelevant \tn % Row Count 13 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{chmod symbolic notation} \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} u & user \tn % Row Count 15 (+ 1) % Row 13 \SetRowColor{white} g & group \tn % Row Count 16 (+ 1) % Row 14 \SetRowColor{LightBackground} o & others, world \tn % Row Count 17 (+ 1) % Row 15 \SetRowColor{white} a & all \tn % Row Count 18 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{example notation} \tn % Row Count 19 (+ 1) % Row 17 \SetRowColor{white} u+x & add execute permission for the owner \tn % Row Count 21 (+ 2) % Row 18 \SetRowColor{LightBackground} u-x & remove execute permission from the owner \tn % Row Count 23 (+ 2) % Row 19 \SetRowColor{white} +x & add execute for everyone, same as a+x \tn % Row Count 25 (+ 2) % Row 20 \SetRowColor{LightBackground} o-rw & remove read and write for everyone but owner and group \tn % Row Count 28 (+ 3) % Row 21 \SetRowColor{white} u+x,go=rx & add excute for owner, group and world changed to read and execute \tn % Row Count 31 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.34379 cm} x{3.63321 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{umask new file default permissions}} \tn % Row 0 \SetRowColor{LightBackground} umask & 0022 ubuntu default \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \# position 0-{}-{}- & 4000 sets program ownership to app \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} & 2000 sets group ownership for shared directories \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} & 1000 set to a directory prevents files from being deleted in shared directory \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{the last three are octal permissions} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{system stuff}} \tn % Row 0 \SetRowColor{LightBackground} printenv | less & system information \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} printenv USER & views the contents of a variable, example USER contains your user name \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} set | less & display shell and environment variables \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} echo \$HOME & echo can be used to view single variables \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} alias & lists all alias commands \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} {[}command{]}; alert {[}message{]} & to get a notification when a command is done(an alias in ubuntu) \tn % Row Count 15 (+ 4) % Row 6 \SetRowColor{LightBackground} below are some variables of interest & {\bf{{\emph{}}{\bf{}}}}{\bf{{\emph{}}{\bf{}}}}{\bf{{\emph{}}{\bf{}}}}** \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} DISPLAY & the name of your display enviroment \tn % Row Count 19 (+ 2) % Row 8 \SetRowColor{LightBackground} EDITOR & the default text editor \tn % Row Count 21 (+ 2) % Row 9 \SetRowColor{white} SHELL & name of the shell running \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} HOME & path to home directory \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} LANG & keyboard language \tn % Row Count 26 (+ 1) % Row 12 \SetRowColor{LightBackground} OLD\_PWD & the previous working directory \tn % Row Count 28 (+ 2) % Row 13 \SetRowColor{white} PAGER & the name of the program used for paging output. Usually is app less \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{system stuff (cont)}} \tn % Row 14 \SetRowColor{LightBackground} PATH & a colon separated list of directories that are searched when you enter the name of an executable program \tn % Row Count 5 (+ 5) % Row 15 \SetRowColor{white} PS1 & prompt string 1, defines the contents of shell prompt \tn % Row Count 8 (+ 3) % Row 16 \SetRowColor{LightBackground} PWD & current working directory \tn % Row Count 10 (+ 2) % Row 17 \SetRowColor{white} TERM & the name of your terminal type \tn % Row Count 12 (+ 2) % Row 18 \SetRowColor{LightBackground} TZ & time zone \tn % Row Count 13 (+ 1) % Row 19 \SetRowColor{white} USER & your username \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Storage Media command overview}} \tn % Row 0 \SetRowColor{LightBackground} mount & mount a file system \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} umount & un-mount a file system (pay attention to the spelling of the command Umount) \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} fdisk & partition table manipulator \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} fsck & check and repair a filesystem \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} fdformat & format a floppy disk \tn % Row Count 10 (+ 1) % Row 5 \SetRowColor{white} mkfs & make a filesystem \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} dd & write block-oriented data directly to a device \tn % Row Count 14 (+ 3) % Row 7 \SetRowColor{white} genisoimage (mkisos) & create an ISO 9660 image file \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} wodim (cdrecord) & write data to an optical storage \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} md5sum & calculate MD5 checksum \tn % Row Count 19 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{LISTING DEVICES AND FILESYSTEMS}}} \tn % Row Count 20 (+ 1) % Row 11 \SetRowColor{white} /etc/fstab & is a list of devices \tn % Row Count 21 (+ 1) % Row 12 \SetRowColor{LightBackground} mount & will view a list of mounted filesystems \tn % Row Count 23 (+ 2) % Row 13 \SetRowColor{white} ls /dev & list devices \tn % Row Count 24 (+ 1) % Row 14 \SetRowColor{LightBackground} /dev/fd* & floppy disks \tn % Row Count 25 (+ 1) % Row 15 \SetRowColor{white} /dev/hd* & hard drives \tn % Row Count 26 (+ 1) % Row 16 \SetRowColor{LightBackground} /dev/lp* & printers \tn % Row Count 27 (+ 1) % Row 17 \SetRowColor{white} /dev/sd* & SCSI disks \tn % Row Count 28 (+ 1) % Row 18 \SetRowColor{LightBackground} /dev/sr* & Optical drives CD/DVD readers and burners \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Storage Media command overview (cont)}} \tn % Row 19 \SetRowColor{LightBackground} sudo tail -f /var/log/syslog & to see real time device changes in the system \tn % Row Count 3 (+ 3) % Row 20 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{MOVING DEV MOUNT LOCATIONS}}} \tn % Row Count 4 (+ 1) % Row 21 \SetRowColor{LightBackground} sudo mkdir /mnt/flash & make a dir to mount flash drive \tn % Row Count 6 (+ 2) % Row 22 \SetRowColor{white} sudo mount /dev/sdb1 /mnt/flash & moves the location to the new one (use the proper device name before moving) \tn % Row Count 10 (+ 4) % Row 23 \SetRowColor{LightBackground} df & display disk space df -h for human readable \tn % Row Count 12 (+ 2) \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}{system startup stuff}} \tn % Row 0 \SetRowColor{LightBackground} /etc/profile & a global configuration script that applies to all users \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \textasciitilde{}/.bash\_profile & a users personal startup file. can override the global config script \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} \textasciitilde{}/.bash\_login & if \textasciitilde{}/.bash\_profile is not found, bash attempts to read this one \tn % Row Count 11 (+ 4) % Row 3 \SetRowColor{white} \textasciitilde{}/.profile & if neither bash profile or login are found this is run. this is the default in Ubuntu \tn % Row Count 16 (+ 5) % Row 4 \SetRowColor{LightBackground} /etc/bash/bashrc & a global config script that applies to all users \tn % Row Count 19 (+ 3) % Row 5 \SetRowColor{white} \textasciitilde{}/.bashrc & a users personal startup file \tn % Row Count 21 (+ 2) % Row 6 \SetRowColor{LightBackground} files that start with a period are hidden & is -a option when searching with ls \tn % Row Count 24 (+ 3) \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}{fdisk commands}} \tn % Row 0 \SetRowColor{LightBackground} sudo umount /dev/sdb1 & unmount the partition \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sudo fdisk /dev/sdb & mount the entire drive \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{fdsik commands}}} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} p & print partition tables \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} l & list known partition types \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} t & change a partitions system id \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} w & write partition changes \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} q & quit fdisk \tn % Row Count 12 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.9908 cm} x{2.9862 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{creating a new filesystem with mkfs}} \tn % Row 0 \SetRowColor{LightBackground} sudo mkfs -t ext3 /dev/sdb1 & make an ext3 filesystem on device sdb1 partition \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sudo mkfs -t vfat /dev/sdb1 & make a fat32 silesystem on device sdb1 \tn % Row Count 4 (+ 2) \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}{testing and repairing filesystems with fsck}} \tn % Row 0 \SetRowColor{LightBackground} sudo fsck /dev/sdb1 & checks the filesystem on sdb1 partition \tn % Row Count 2 (+ 2) \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}{Moving data directly to and from devices with dd}} \tn % Row 0 \SetRowColor{LightBackground} dd & raw copy tool (dd has 2 names, data definition and destroy disk) \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} dd if=input\_file of=output\_file {[}bs=block\_size {[}count=blocks{]}{]} & syntax to dd raw copy \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} dd if=/dev/sdb of=/dev/sdc & copy 2 identical usb drives that are the same size \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} dd if=/dev/sdb of=flash\_drive.img & make a raw image of the drive \tn % Row Count 13 (+ 2) \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}{creating CD-ROM images}} \tn % Row 0 \SetRowColor{LightBackground} dd if=/dev/cdrom of=ubuntu.iso & copy the contents of a cd to an image file \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} cdrdao & is used for audio cds \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{creating an iso from a collection of files}}} \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} genisoimage -o cd-rom.iso -R -J \textasciitilde{}/cd-rom-files & if you had a directory called /cd-rom-files, you could use this command to make an image of the directory \tn % Row Count 12 (+ 6) % Row 4 \SetRowColor{LightBackground} the -R -J options defined & the allow the use of long filenames \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{mounting an iso image directly}}} \tn % Row Count 15 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{using the -o loop with mount} \tn % Row Count 16 (+ 1) % Row 7 \SetRowColor{white} mkdir /mnt/iso\_image & then the next line down \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} mount -t iso9660 -o loop image.iso /mnt/iso\_image & mounts the iso as a virtual drive \tn % Row Count 21 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{blanking a RW CD}}} \tn % Row Count 22 (+ 1) % Row 10 \SetRowColor{LightBackground} wodim dev=/dev/cdrw blank=fast & there are other types of blanking \tn % Row Count 24 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{writing an image file}}} \tn % Row Count 25 (+ 1) % Row 12 \SetRowColor{LightBackground} wodim dev=/dev/cdrw image.iso & writes an image to cd \tn % Row Count 27 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{MD5 checksum}} \tn % Row 0 \SetRowColor{LightBackground} md5sum image.iso & will give you the md5 checksum value \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} md5sum /dev/cdrom & a cd-r write in disc at once can be checked like this \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.23965 cm} x{2.73735 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{lynis (auditing,hardening)}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt install lynis & install it \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} lynis audit system & perform local security scan \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} lynis show version & version \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} -{}-verbose & details \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} -{}-pentest & non privileged scan \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{systemctl (services)}} \tn % Row 0 \SetRowColor{LightBackground} systemctl -all or -a & see all loaded processes \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} list-units & list units currently in memory \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} list-sockets & list sockets currently in memory \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} list-unit-files & list installed unit files \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} poweroff & turn the computer off \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} reboot & shutdown and restart \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{is-system-running} & checks to see if the system is running \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} -{}-type service -{}-state running & searching for running services \tn % Row Count 14 (+ 2) \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}{ps (running processes)}} \tn % Row 0 \SetRowColor{LightBackground} ps -e & all running processes \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ps aux | grep telnet & search for telnet running \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} ps \#\#\#\# & \# = number for PID to view \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} ps -aux & custom running process search \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} ps -{}-help all & list more commands \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} ps & report a snapshot of the current running processes \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} top & display tasks with the top active ones \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} jobs & list active jobs \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} bg & place a job in the background \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} fg & place a job in the foreground \tn % Row Count 16 (+ 2) % Row 10 \SetRowColor{LightBackground} kill & send a signal to a process via PID \tn % Row Count 18 (+ 2) % Row 11 \SetRowColor{white} killall & kill process by name \tn % Row Count 19 (+ 1) % Row 12 \SetRowColor{LightBackground} shutdown & shut down or reboot the system \tn % Row Count 21 (+ 2) % Row 13 \SetRowColor{white} xlogo & creates a nonsense xlogo app for debuging and testing ps controls \tn % Row Count 24 (+ 3) % Row 14 \SetRowColor{LightBackground} {[}CTRL-c{]} & terminates programs started in terminal \tn % Row Count 26 (+ 2) % Row 15 \SetRowColor{white} xlogo \& & \& will make a program start in the background \tn % Row Count 28 (+ 2) % Row 16 \SetRowColor{LightBackground} fg \%1 & will bring the program to the foreground \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ps (running processes) (cont)}} \tn % Row 17 \SetRowColor{LightBackground} {[}CTRL-z{]} & stops or pauses a process \tn % Row Count 1 (+ 1) % Row 18 \SetRowColor{white} bg \%1 & put program in background \tn % Row Count 2 (+ 1) % Row 19 \SetRowColor{LightBackground} killall {[}process name{]} & killall xlogo for example if multiples are running \tn % Row Count 4 (+ 2) % Row 20 \SetRowColor{white} pstree & outputs a process list in a tree pattern \tn % Row Count 6 (+ 2) % Row 21 \SetRowColor{LightBackground} vmstat & system resource snapshot {[}vmstat5{]} for continuous feed \tn % Row Count 9 (+ 3) % Row 22 \SetRowColor{white} xload & GUI draws a graph, showing sys stats overtime \tn % Row Count 11 (+ 2) % Row 23 \SetRowColor{LightBackground} tload & a terminal version of xload \tn % Row Count 13 (+ 2) % Row 24 \SetRowColor{white} tload & a terminal version of xload \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{netstat}} \tn % Row 0 \SetRowColor{LightBackground} netstat & -tulpn \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -l (L) & display listening sockets \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} -n & don't resolve names \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} -p & display PID \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} -s & an overview - statistics \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} -g & group memberships \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} -r & router table \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} -i & interface table \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Customizing the Prompt}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{adjust how the prompt is displayed and operates} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} echo \$PS1 & display the current prompt setup \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{ps1\_old="\$PS1"} & make a backup before making changes called ps1\_old. check with echo \$ps1\_old \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{PS1="\$ps1\_old"} & restore the original \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} PS1= & clear all prompt data (no visible prompt) \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{PROMPT VALUES}} & ubuntu default value is: {[}\textbackslash{}u@\textbackslash{}h \textbackslash{}W{]}\textbackslash{}\$ \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} PS1="\textbackslash{}\$ " & a minimal prompt \tn % Row Count 13 (+ 1) % Row 7 \SetRowColor{white} \textbackslash{}a & ASCII bell. Makes the computer beep \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} \textbackslash{}d & current date in day, month, date format \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} \textbackslash{}h & hostname of the local machine minus the domain \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} \textbackslash{}H & full hostname \tn % Row Count 20 (+ 1) % Row 11 \SetRowColor{white} \textbackslash{}j & number of jobs in the current shell \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} \textbackslash{}l & name of the current terminal device \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} \textbackslash{}n & a newline character \tn % Row Count 25 (+ 1) % Row 14 \SetRowColor{LightBackground} \textbackslash{}r & a carriage return \tn % Row Count 26 (+ 1) % Row 15 \SetRowColor{white} \textbackslash{}s & name of the shell program \tn % Row Count 27 (+ 1) % Row 16 \SetRowColor{LightBackground} \textbackslash{}t & current time in 24hour H:M:S \tn % Row Count 28 (+ 1) % Row 17 \SetRowColor{white} \textbackslash{}T & current time in 12hour format \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Customizing the Prompt (cont)}} \tn % Row 18 \SetRowColor{LightBackground} \textbackslash{}@ & current time in 12hour am/pm format \tn % Row Count 2 (+ 2) % Row 19 \SetRowColor{white} \textbackslash{}A & current time in 24 hour H:M \tn % Row Count 3 (+ 1) % Row 20 \SetRowColor{LightBackground} \textbackslash{}u & username of the current user \tn % Row Count 4 (+ 1) % Row 21 \SetRowColor{white} \textbackslash{}v & version number of the shell \tn % Row Count 5 (+ 1) % Row 22 \SetRowColor{LightBackground} \textbackslash{}V & version and release number of the shell \tn % Row Count 7 (+ 2) % Row 23 \SetRowColor{white} \textbackslash{}w & name of the current working directory \tn % Row Count 9 (+ 2) % Row 24 \SetRowColor{LightBackground} \textbackslash{}W & last part of the working directory \tn % Row Count 11 (+ 2) % Row 25 \SetRowColor{white} \textbackslash{}! & history number of the current command \tn % Row Count 13 (+ 2) % Row 26 \SetRowColor{LightBackground} \textbackslash{}\# & number of commands entered in shell \tn % Row Count 15 (+ 2) % Row 27 \SetRowColor{white} \textbackslash{}\$ & displays the \$ character unless you have root, in that case it displays \# \tn % Row Count 18 (+ 3) % Row 28 \SetRowColor{LightBackground} \textbackslash{}{[} & the start of a series of one or more non-printing characters \tn % Row Count 21 (+ 3) % Row 29 \SetRowColor{white} \textbackslash{}{]} & the end of a non-printing character sequence \tn % Row Count 23 (+ 2) % Row 30 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{COLOR TEXT}}} \tn % Row Count 24 (+ 1) % Row 31 \SetRowColor{white} \textbackslash{}033{[}0;30m & black \tn % Row Count 25 (+ 1) % Row 32 \SetRowColor{LightBackground} \textbackslash{}033{[}0;31m & red \tn % Row Count 26 (+ 1) % Row 33 \SetRowColor{white} \textbackslash{}033{[}0;32m & green \tn % Row Count 27 (+ 1) % Row 34 \SetRowColor{LightBackground} \textbackslash{}033{[}0;33m & brown \tn % Row Count 28 (+ 1) % Row 35 \SetRowColor{white} \textbackslash{}033{[}0;34m & blue \tn % Row Count 29 (+ 1) % Row 36 \SetRowColor{LightBackground} \textbackslash{}033{[}0;35m & purple \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Customizing the Prompt (cont)}} \tn % Row 37 \SetRowColor{LightBackground} \textbackslash{}033{[}0;36m & cyan \tn % Row Count 1 (+ 1) % Row 38 \SetRowColor{white} \textbackslash{}033{[}0;37m & light grey \tn % Row Count 2 (+ 1) % Row 39 \SetRowColor{LightBackground} \textbackslash{}033{[}1;30m & dark grey \tn % Row Count 3 (+ 1) % Row 40 \SetRowColor{white} \textbackslash{}033{[}1;31m & light red \tn % Row Count 4 (+ 1) % Row 41 \SetRowColor{LightBackground} \textbackslash{}033{[}1;32m & light green \tn % Row Count 5 (+ 1) % Row 42 \SetRowColor{white} \textbackslash{}033{[}1;33m & yellow \tn % Row Count 6 (+ 1) % Row 43 \SetRowColor{LightBackground} \textbackslash{}033{[}1;34m & light blue \tn % Row Count 7 (+ 1) % Row 44 \SetRowColor{white} \textbackslash{}033{[}1;35m & light purple \tn % Row Count 8 (+ 1) % Row 45 \SetRowColor{LightBackground} \textbackslash{}033{[}1;36m & light cyan \tn % Row Count 9 (+ 1) % Row 46 \SetRowColor{white} \textbackslash{}033{[}1;37m & white \tn % Row Count 10 (+ 1) % Row 47 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{BACKGROUND COLOR}}} \tn % Row Count 11 (+ 1) % Row 48 \SetRowColor{white} \textbackslash{}033{[}0;40m & black \tn % Row Count 12 (+ 1) % Row 49 \SetRowColor{LightBackground} \textbackslash{}033{[}0;41m & red \tn % Row Count 13 (+ 1) % Row 50 \SetRowColor{white} \textbackslash{}033{[}0;42m & green \tn % Row Count 14 (+ 1) % Row 51 \SetRowColor{LightBackground} \textbackslash{}033{[}0;43m & brown \tn % Row Count 15 (+ 1) % Row 52 \SetRowColor{white} \textbackslash{}033{[}0;44m & blue \tn % Row Count 16 (+ 1) % Row 53 \SetRowColor{LightBackground} \textbackslash{}033{[}0;45m & purple \tn % Row Count 17 (+ 1) % Row 54 \SetRowColor{white} \textbackslash{}033{[}0;46m & cyan \tn % Row Count 18 (+ 1) % Row 55 \SetRowColor{LightBackground} \textbackslash{}033{[}0;47m & light gray \tn % Row Count 19 (+ 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}{Searching for files commands}} \tn % Row 0 \SetRowColor{LightBackground} locate & find files by name \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} find & search for files in directory hierarchy \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} xargs & build and execute command lines from standard input \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} touch & change file times \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} stat & display file or filesystem status \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{locate (find files the easy way)}}} \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} locate bin/zip & locate will search for any string with bin and zip \tn % Row Count 13 (+ 3) % Row 7 \SetRowColor{white} locate zip | grep bin & and fancier search \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{find (find files the hard way)}}} \tn % Row Count 16 (+ 1) % Row 9 \SetRowColor{white} find \textasciitilde{} & a list of directories in our home dir \tn % Row Count 18 (+ 2) % Row 10 \SetRowColor{LightBackground} find \textasciitilde{} | wc -l & use word count to find how many files \tn % Row Count 20 (+ 2) % Row 11 \SetRowColor{white} find \textasciitilde{} -type d | wc -l & find how many directories with word count \tn % Row Count 23 (+ 3) % Row 12 \SetRowColor{LightBackground} find \textasciitilde{} -type f | wc -l & find regular files with word count \tn % Row Count 25 (+ 2) % Row 13 \SetRowColor{white} find \textasciitilde{} type f -name "*.JPG" -size +1M | wc -l & find files with the name .jpg larger than 1 mb and count them \tn % Row Count 29 (+ 4) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{ find test}}} \tn % Row Count 30 (+ 1) \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}{Searching for files commands (cont)}} \tn % Row 15 \SetRowColor{LightBackground} -cmin n & match files of dirs whose content was modified exactly n minutes ago \tn % Row Count 4 (+ 4) % Row 16 \SetRowColor{white} -cnewer file & match files or directories whose content was last modified more recently than the file named \tn % Row Count 9 (+ 5) % Row 17 \SetRowColor{LightBackground} -ctime & match files or dirs that were modified within the last 24hours \tn % Row Count 13 (+ 4) % Row 18 \SetRowColor{white} -empty & match empty files or dirs \tn % Row Count 15 (+ 2) % Row 19 \SetRowColor{LightBackground} -group name & match files or dirs belonging to a group \tn % Row Count 17 (+ 2) % Row 20 \SetRowColor{white} -iname pattern & like name but case sensitive \tn % Row Count 19 (+ 2) % Row 21 \SetRowColor{LightBackground} -inum n & match files with inode number n \tn % Row Count 21 (+ 2) % Row 22 \SetRowColor{white} -mmin n & match files of dir whose contents were modified n mins ago \tn % Row Count 24 (+ 3) % Row 23 \SetRowColor{LightBackground} -mtime n & match files or dirs whose contents where modified n 24 hours ago \tn % Row Count 28 (+ 4) % Row 24 \SetRowColor{white} -name pattern & match files with wildcard pattern \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}{Searching for files commands (cont)}} \tn % Row 25 \SetRowColor{LightBackground} -newer file & match files or dirs whose content was modifies more recently than specified file \tn % Row Count 4 (+ 4) % Row 26 \SetRowColor{white} -nouser & match files or dirs that do not belong to a user \tn % Row Count 7 (+ 3) % Row 27 \SetRowColor{LightBackground} -nogroup & match files that do not belong to a group \tn % Row Count 10 (+ 3) % Row 28 \SetRowColor{white} -perm mode & match files that have permission set to a specific mode \tn % Row Count 13 (+ 3) % Row 29 \SetRowColor{LightBackground} -samefile name & match files with the same inode number, similar to -inum test \tn % Row Count 17 (+ 4) % Row 30 \SetRowColor{white} -size n & match file of size n \tn % Row Count 18 (+ 1) % Row 31 \SetRowColor{LightBackground} -type c & match files of c type \tn % Row Count 20 (+ 2) % Row 32 \SetRowColor{white} -user name & match files or dir belonging to user name \tn % Row Count 23 (+ 3) % Row 33 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{find logical operators}}} \tn % Row Count 24 (+ 1) % Row 34 \SetRowColor{white} -and & match if both sides are true, also known as -a \tn % Row Count 27 (+ 3) % Row 35 \SetRowColor{LightBackground} -or & match is one side is true also known as -o \tn % Row Count 30 (+ 3) \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}{Searching for files commands (cont)}} \tn % Row 36 \SetRowColor{LightBackground} -not & match if the following test is false, also know as -! \tn % Row Count 3 (+ 3) % Row 37 \SetRowColor{white} ( ) & group tests together to form larger expressions \tn % Row Count 6 (+ 3) % Row 38 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{examples}}} \tn % Row Count 7 (+ 1) % Row 39 \SetRowColor{white} -type f -and -not -perms 0600 & testing for bad permissions by testing for good ones \tn % Row Count 10 (+ 3) % Row 40 \SetRowColor{LightBackground} find \textasciitilde{} (-type f -not - perms 0600) -or (-type d -not -perms 0700) & test for bad files and directories \tn % Row Count 14 (+ 4) % Row 41 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{actions for find}}} \tn % Row Count 15 (+ 1) % Row 42 \SetRowColor{LightBackground} -delete & delete the currently matching file(see warning) \tn % Row Count 18 (+ 3) % Row 43 \SetRowColor{white} -ls & perform the equivalent of ls -dils on the matching file. \tn % Row Count 21 (+ 3) % Row 44 \SetRowColor{LightBackground} -print & output the full pathname of the file \tn % Row Count 23 (+ 2) % Row 45 \SetRowColor{white} -print0 & used to correctly print file names with spaces \tn % Row Count 26 (+ 3) % Row 46 \SetRowColor{LightBackground} -quit & quit once a match has been made \tn % Row Count 28 (+ 2) % Row 47 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{warning for delete}}} \tn % Row Count 29 (+ 1) % Row 48 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{always use -print as a substitute for -delete to see what will be deleted} \tn % Row Count 31 (+ 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}{Searching for files commands (cont)}} \tn % Row 49 \SetRowColor{LightBackground} find \textasciitilde{} -type f -name '*.BAK' -print & -print the files to output before deleting \tn % Row Count 3 (+ 3) % Row 50 \SetRowColor{white} find \textasciitilde{} -type f -name '*.BAK' -delete & then proceed if you wish to delete still \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}