\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{Mary F. Smith (boogie)} \pdfinfo{ /Title (linux-command-sheet.pdf) /Creator (Cheatography) /Author (Mary F. Smith (boogie)) /Subject (Linux Command Sheet 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}{0740A3} \definecolor{LightBackground}{HTML}{EFF3F9} \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 Command Sheet Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Mary F. Smith (boogie)} via \textcolor{DarkBackground}{\uline{cheatography.com/86236/cs/20137/}}} \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}Mary F. Smith (boogie) \\ \uline{cheatography.com/boogie} \\ \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 8th March, 2023.\\ 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{1.36 cm} x{6.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Information}} \tn % Row 0 \SetRowColor{LightBackground} pwd & | print working directory \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} cat & | print file {[}on screen{]} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{hostname} & | display hostname \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} -i {[}displays network address{]} -l {[}displays all local IPs{]}} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} date & | set/display date \& time \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{whois} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{uptime} & | display how long the system has been running \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} cal & | displays calendar \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} uname -a & | displays Linux system info \tn % Row Count 13 (+ 2) % Row 9 \SetRowColor{white} uname -r & | displays kernel info \tn % Row Count 15 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{lsb\_release -s} \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Manage Users}} \tn % Row 0 \SetRowColor{LightBackground} su - & | switch to root user \& move to that directory \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} adduser & | add new user \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} usermod -aG sudo {\emph{username}} & | add user to sudo list \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} groups {\emph{username}} & | list groups a user belongs too \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} su mfsmith & | switch to listed user mfsmith \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} passwd & | change password for current user name \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} passwd mfsmith & | change password for listed user \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} adduser mfsmith -or- useradd mfsmith & | Creates a new user \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} usermod mfsmith & | modify username account \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} deluser mfsmith -or- userdel & | Deletes user \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} deluser mfsmith -{}-remove-all-files & | Deletes the user and removes all files in directory \tn % Row Count 23 (+ 3) % Row 11 \SetRowColor{white} getent powerusers | less & | print user groups \tn % Row Count 25 (+ 2) % Row 12 \SetRowColor{LightBackground} usermod -l newusername oldusername & | change user name \tn % Row Count 27 (+ 2) % Row 13 \SetRowColor{white} sudo chfn mfsmith & | edit basic info i.e. full name, room \#, phone \# \tn % Row Count 30 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Process Management}} \tn % Row 0 \SetRowColor{LightBackground} ps & | displays users current processes \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ps -ef & | displays all processes \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} pmap & | displays memory usage \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} pstree & | display in a tree \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} ps -ef | grep wa & | display all info reference this process \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} ps kill 84679 & | kill process id 84679 \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} ps killall java & | kill all processes named java \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} top & | show all running proicesses \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.68 cm} x{6.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Disk/Hardware Mgmt}} \tn % Row 0 \SetRowColor{LightBackground} df -h & | disk usage \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ps & | running processes \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{System Monitoring}} \tn % Row 0 \SetRowColor{LightBackground} whoami & | display user \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} uptime & | system run time \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} cat \seqsplit{/proc/cpuinfo} & | \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} free -h & | display free memory\} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} lshw & | print hardware configuration \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} last reboot & | disaply date \& time of last reboot \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} w & | display currently logged in users \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Searching}} \tn % Row 0 \SetRowColor{LightBackground} locate {[}name of file{]} & | searches system \& locates that directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} find . -name {[}9414811\_49794.pdf{]} & | search in current directory for file name \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} find /home -name *.jpg & | search file type in listed directory \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\emph{Using GREP}} & | grep searches for patterns in files \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{grep -r} \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} command | grep & | searches the output of a command \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{OS Maintenance}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt update & | check for updates in current version \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} apt-get install docker & | install docker \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{apt-get updater \&\& apt-get upgrade} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Misc Need Organizing}} \tn % Row 0 \SetRowColor{LightBackground} ssh mfsmith@srv-tower & log into machine \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{scp mfsmith@srv-tower :srv-dc} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} scp\textless{}username.@\textless{}host:{[}remote sourse{]} \textless{}local. & copies files from the host to the destination \tn % Row Count 6 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Working with Processes}} \tn % Row 0 \SetRowColor{LightBackground} pstree & | display a tree of processes \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} systemctl processname & | control the systemd init system \& service manager \tn % Row Count 4 (+ 2) \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}{Working with File Permissions}} \tn % Row 0 \SetRowColor{LightBackground} chmod 777 {[}name of file{]} & | assign read, write \& execute to all users \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} chmod 755 {[}name of file{]} & | read, write \& execute for owner - read \& execute for all other users \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} chmod 766 {[}name of file{]} & | full permission to owner - read and write to others \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.8 cm} x{7.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SuperUser}} \tn % Row 0 \SetRowColor{LightBackground} su - & Change to superuser \& stay at root directory \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.8 cm} x{7.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{General Maintenance}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Update \& Upgrade the Debian OS} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & sudo apt-get update \&\& sudo apt-get upgrade \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Installs - Frequently Used}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{vagrant@debian11:/ {\bf{sudo apt-get install nano -y}}} \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Network Mgmt}} \tn % Row 0 \SetRowColor{LightBackground} vagrant@debian11:/ {\bf{ip -c link show}} & | displays network devices \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} vagrant@debian11:/ {\bf{sudo cp \seqsplit{/etc/network/interfaces} \textasciitilde{}/}} & | creates a copy of the network file \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 5 (+ 0) % Row 3 \SetRowColor{white} vagrant@debian11:/ {\bf{sudo nano /etc/network/interfaces}} & | opens the network file for editing i.e. creating a static IP \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\# The loopback network interface \newline auto lo \newline iface lo inet loopback \newline \newline \# The primary network interface \newline -auto enp0s3 \newline iface enp0s3 inet static \newline -address 192.168.1.97 \newline -netmask 255.255.255.0 \newline -gateway 192.168.1.1 \newline -dns-domain example.com \newline -dns-nameservers 1.1.1.1 \newline \newline {\bf{sudo systemctl restart networking}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.04 cm} x{6.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Directory Structure}} \tn % Row 0 \SetRowColor{LightBackground} / & | root directory of operating system \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} /etc & | host system config files \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} /var & | storage for file which grow in size \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} /bin & | user binary files i.e. cat, grep, etc. \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} /proc & | system processes \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} /srv & | system services \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} /mnt & | ppermenet storage \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} /home & | home directory for logged in user \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} /lib & | shared library files and kernel modules \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} /usr & | user utilities and apps \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} /dev & | device files i.e. mouse, keyboard, harddrive, etc. \tn % Row Count 17 (+ 2) % Row 11 \SetRowColor{white} /sbin & | system binary files \tn % Row Count 18 (+ 1) % Row 12 \SetRowColor{LightBackground} /opt & | option software \tn % Row Count 19 (+ 1) % Row 13 \SetRowColor{white} \seqsplit{/media} & | temp storage/flash drives \tn % Row Count 21 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Directory Colors}} \tn % Row 0 \SetRowColor{LightBackground} Blue | Directory & Yellow | Device \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Green | Executable & Magenta | Graphic Image \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Cyan | symbolic Link & Red | Archive File \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} & Red \& Black | Broken link \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.44 cm} x{6.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Working with Directories}} \tn % Row 0 \SetRowColor{LightBackground} ls & | list contents of current directory \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ls -r & | list files in subdirectories \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} ls -al & | list files with directories, size, permissions etc. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} ls-l & |list files and permissions \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} & r {[}read{]} w{[}write{]} x {[}execute{]} -= {[}no permissions \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} ls -a & | list contents of current directory including hidden files \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} ls -lart & | long, include hidden, {\bf{{\emph{, }}}} \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} ls -d*/ & | list directories \tn % Row Count 13 (+ 1) % Row 8 \SetRowColor{LightBackground} cd \textasciitilde{} & | jump to users home \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} cd.. & | jump to last directory \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} cd / & | jump to root home directory \tn % Row Count 16 (+ 1) % Row 11 \SetRowColor{white} cd - & | previous working directory \tn % Row Count 17 (+ 1) % Row 12 \SetRowColor{LightBackground} cd ../../ & | back up two levels \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.2 cm} x{2.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{File Management}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{cp file name {[}-r creates destination{]}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} mv Linux Command Cheatsheet to Linux Command Line Cheatsheet & | is also for renaming \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{cat filename} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{less} \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{mkdir\textbackslash{}rm directory} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{rm} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{cd} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.76 cm} x{6.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Troubleshooting}} \tn % Row 0 \SetRowColor{LightBackground} Issue: & usermod command not found \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{Resolution:} & \{\{ar\}\} use su - instead of su root \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Issue: & wget command not found \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \seqsplit{Resolution:} & \{\{ar\}\} sudo apt-get install wget \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} Issue: & cannot access repositories \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \seqsplit{Resolution:} & manually add site via {\bf{nano /etc/apt/sources.list}} \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.24 cm} x{5.76 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Mariadb Commands}} \tn % Row 0 \SetRowColor{LightBackground} Log into DB & sudo systemctl enable mysql \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & sudo systemctl restart mysql \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} & sudo mysql -u root -p \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.4 cm} x{3.6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Queries}} \tn % Row 0 \SetRowColor{LightBackground} select user from mysql.user; & | displays all database users \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} show grants for 'zabbix'@'locahosts' & | displays user privileges \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{set password for 'zabbix'@'localhost = password ('zabbix');} \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Install Mariadb-Server}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{sudo apt install mariadb-server} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{sudo \seqsplit{mysql\_secure\_installation}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{sudo mariadb} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{CREATE DATABASE example\_database;} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{ALTER DATABASE test CHARACTER SET='utf8' COLLATE='utf8\_bin';} \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{GRANT ALL ON example\_database.* TO \seqsplit{'example\_user'@'localhost'} IDENTIFIED BY 'password' WITH GRANT OPTION;} \tn % Row Count 9 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{FLUSH PRIVILEGES;} \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{exit} \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} sudo mariadb & mariadb -u example\_user -p \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{SHOW DATABASES;} \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.4 cm} x{5.6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Networking Command/Queries}} \tn % Row 0 \SetRowColor{LightBackground} ip a & | display IP Address, routing, devices and tunnels \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} netstat & | displays all active TCP connections, ports \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} {\bf{-nutlp {[}displays tcp/udp ports \& application running on port{]}}}} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{ar\}\} {\bf{-e {[}includes ethernet stats{]} -o {[}includes PIDs{]} -p {[}displays protocols{]} -r {[}displays routing table{]}}}} \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} ping & | test communication with machines \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} traceroute srv-dc & print packet route \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} host & | DNS lookup utililty \tn % Row Count 14 (+ 1) % Row 7 \SetRowColor{white} hostname & | show or set system name \tn % Row Count 15 (+ 1) % Row 8 \SetRowColor{LightBackground} iptables & |utililty for packet filtering and NAT \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} mtr & | network diagnostic tool \tn % Row Count 18 (+ 1) % Row 10 \SetRowColor{LightBackground} telnet & | access to the telnet tool \tn % Row Count 19 (+ 1) % Row 11 \SetRowColor{white} ufw & | application to mange filters and firewalls \tn % Row Count 21 (+ 2) % Row 12 \SetRowColor{LightBackground} mtr & | diagnostic tool \tn % Row Count 22 (+ 1) % Row 13 \SetRowColor{white} nbtstat & | displays netbios over tcp \tn % Row Count 23 (+ 1) % Row 14 \SetRowColor{LightBackground} arp & | displays caches apr table \tn % Row Count 24 (+ 1) % Row 15 \SetRowColor{white} pathping & | disaplys info about network latency/loss between hops \tn % Row Count 26 (+ 2) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{tcpdump} \tn % Row Count 27 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.2 cm} x{4.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Firewall}} \tn % Row 0 \SetRowColor{LightBackground} sudo apt-get install ufw & | install firewall application \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sudo ufw allow 'Nginx HTTP' & | allow application to pass through firewall \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} sudo ufw status & | check firewall status \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} sudo ufw disable & | disable firewall \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} sudo ufw enable & | enable firewall \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} sudo ufw allow 22 & | allow port number to pass \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} sudo ufw reset & | reset firewall \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}