\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{rajuganesh} \pdfinfo{ /Title (linux.pdf) /Creator (Cheatography) /Author (rajuganesh) /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}{33A354} \definecolor{LightBackground}{HTML}{F2F9F4} \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}{rajuganesh} via \textcolor{DarkBackground}{\uline{cheatography.com/104561/cs/25038/}}} \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}rajuganesh \\ \uline{cheatography.com/rajuganesh} \\ \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 28th April, 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{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{List files}} \tn % Row 0 \SetRowColor{LightBackground} listed view & `ls -l` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} show hidden files also & `ls -la` \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} show size in human readable & `ls -lah` \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} showfile created today & `ls -ltr | grep "\$(date '+\%b \%e')"` \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} show files in tree structure & `tree {[}/path/to/folder{]}` \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.6 cm} x{2.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{vi editor}} \tn % Row 0 \SetRowColor{LightBackground} quit & `:q` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} force quit & `:q!` \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} save and quit & `:wq` \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} find foo and replace all with bar & \seqsplit{`\%s/foo/bar/g`} \tn % Row Count 5 (+ 2) \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}{install loadbalancer}} \tn % Row 0 \SetRowColor{LightBackground} install lb & `yum install ipvsadm` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} enable ip forwarding & `echo 'net.ipv4.ip\_forward = 1' | sudo tee -a /etc/sysctl.conf ` \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} reload & `sudo sysctl -p` \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} check ip forwarding enabled & `sysctl net.ipv4.ip\_forward` \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} create config file & `sudo touch /etc/sysconfig/ipvsadm` \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} start service & `sudo systemctl enable -{}-now ipvsadm` \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} clear iptable rules & `sudo ipvsadm -C` \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} add a virtual service & `ipvsadm -A -t {[}ServiceIP:Port{]} -s {[}Distribution method{]}` \tn % Row Count 16 (+ 3) \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}{ansible}} \tn % Row 0 \SetRowColor{LightBackground} export inventory & `export \seqsplit{ANSIBLE\_INVENTORY=/home/user1/inventory/`} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} run adhoc command in all nodes & `ansible all -a 'uname -r'` \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} run command with multiple forks (default:5) & `ansible all -a 'uname -r' -f 15` \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} run command as different user & `ansible all -a uptime -u userx` \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} copy file & `ansible all -m copy -a "src=testfile \seqsplit{dest=/tmp/testfile"`} \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} check if yum package is present & `ansible all -m yum -a "name=docker state=present"` \tn % Row Count 16 (+ 3) % Row 6 \SetRowColor{LightBackground} check if yum package is absent & `ansible all -m yum -a "name=iperf3 state=absent"` \tn % Row Count 19 (+ 3) % Row 7 \SetRowColor{white} check if installed yum pacakage is latest & `ansible all -m yum -a "name=docker state=latest"` \tn % Row Count 22 (+ 3) % Row 8 \SetRowColor{LightBackground} sudo pass in ansible-playbook & `-{}-extra-vars \seqsplit{"ansible\_sudo\_pass=abcd"`} \tn % Row Count 24 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{encode}} \tn % Row 0 \SetRowColor{LightBackground} encode & `echo 'password@123' |base64` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} encode without newline & `echo 'password@123' |base64 | tr -d \textbackslash{}\textbackslash{}n` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} decode & `echo 'cGFzc3dvcmRAMTIzCg==' |base64 -d` \tn % Row Count 6 (+ 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}{curl}} \tn % Row 0 \SetRowColor{LightBackground} ignore certificate error & `curl -vk https://localhost:8080` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} to grep pattern & `curl -v -{}-silent \seqsplit{https://kid2comp027.ericsson.se:8443} -{}-stderr - | grep {[}pattern{]}` \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} curl tcp & `curl -v telnet://127.0.0.1:22` \tn % Row Count 8 (+ 2) \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}{system stats}} \tn % Row 0 \SetRowColor{LightBackground} get RHEL version & `cat /etc/redhat-release` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} get kernel version & `uname -r` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} get cpu count & `cat /proc/cpuinfo | grep processor | wc -l` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} get processor model & `cat /proc/cpuinfo | grep 'model name' | uniq` \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} get memory & `cat /proc/meminfo |grep MemTotal` \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} get ip addresses & `ip r` \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} get all ip details & `ip a` \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} get list of logged in users & `users` \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} get free disk space & `df -h` \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} get disk usage details & `du -sh {[}path{]}` \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} get id of current user & `id` \tn % Row Count 21 (+ 2) % Row 11 \SetRowColor{white} get id of other user & `id userx` \tn % Row Count 23 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.84 cm} x{6.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{TCP dump}} \tn % Row 0 \SetRowColor{LightBackground} get tcp dump & `tcpdump -i bond0.60 dst 137.10.10.10 and dst port 30000` \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{extend partition}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{RHEL 6} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} check volume group & `vgdisplay vg\_data` \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} volume group extend (if no free space) & `vgextend /dev/VolGroup00 /dev/sda3` \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} extend logical volume & `lvextend -L +2G \seqsplit{/dev/mapper/vg\_data-lv\_docker`} \tn % Row Count 7 (+ 3) % Row 4 \SetRowColor{LightBackground} resize & `resize2fs \seqsplit{/dev/mapper/vg\_data-lv\_docker`} \tn % Row Count 10 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{RHEL 7} \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} & `xfs\_growfs \seqsplit{/dev/mapper/vg\_data-lv\_docker`} \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.84 cm} x{4.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{iperf3}} \tn % Row 0 \SetRowColor{LightBackground} install iperf3 & `yum install iperf3` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} run iperf server on default port 5201 & `iperf3 -s -f K ` (k, m, g for Kbits, Mbits, Gbits or K, M, G for KBytes, Mbytes, Gbytes) \tn % Row Count 6 (+ 5) % Row 2 \SetRowColor{LightBackground} run iperf server on specific port & `iperf3 -s -p 3000` \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} run iperf as daemon & `iperf3 -s -D \textgreater{} iperf3log` \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} run iperf client & `iperf3 -c 192.168.10.1 -f K` \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} run 2 parallel session & `iperf3 -c aedup1mst1 -f G -P 2` \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} run test in reverse direction & `iperf3 -c aedup1mst1 -f G -R` \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} run test in bi direction & `iperf3 -c aedup1mst1 -f G -d` \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} get server output in client & `iperf3 -c aedup1mst1 -f G -{}-get-server-output` \tn % Row Count 21 (+ 3) % Row 9 \SetRowColor{white} set windos socket/buffersize & `iperf3 -c 192.168.10.1 -f K -w 500K` \tn % Row Count 23 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, buffers and protocols (TCP, UDP, SCTP with IPv4 and IPv6). For each test it reports the bandwidth, loss, and other parameters.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.24 cm} x{3.76 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{find}} \tn % Row 0 \SetRowColor{LightBackground} find file matching pattern & `find / -name {\emph{pattern}}` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} find files based on content & `grep -ir "pattern" *` \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.8 cm} x{3.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Generic}} \tn % Row 0 \SetRowColor{LightBackground} Cancel & ctrl + c \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Exit & ctrl + d \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Clear screen & clear \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Clear screen & ctrl + l \tn % Row Count 4 (+ 1) \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}{zip}} \tn % Row 0 \SetRowColor{LightBackground} zip a folder & `zip -r {[}output.zip{]} {[}folder name{]}` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} unzip a folder & `unzip {[}filename{]}` \tn % Row Count 4 (+ 2) \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}{tar}} \tn % Row 0 \SetRowColor{LightBackground} tar a folder & `tar -cvf {[}output.tar{]} {[}/dirname{]}` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} untar a file to diff folder & `tar -C {[}/myfolder{]} -xvf {[}yourfile.tar{]}` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} untar to current folder & `tar -xvf {[}yourfile.tar{]}` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} untar a .tar.gz file & `tar -zxvf {[}yourfile.tar.gz{]}` \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{change host name}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\#method 1} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} edit file hostname & `echo "geeklab" \textgreater{} /etc/hostname` \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} reboot server & `sudo reboot` \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} check hostname & `hostname` \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\#method 2} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} check current hostname & `hostnamectl status` \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} update hostname & `hostnamectl set-hostname geeklab` or `hostnamectl set-hostname "Geeks LAB"` \tn % Row Count 12 (+ 4) % Row 7 \SetRowColor{white} relogin and verify & hostnamectl \tn % Row Count 14 (+ 2) \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}{session timeout}} \tn % Row 0 \SetRowColor{LightBackground} open file & `sudo vi /etc/ssh/sshd\_config` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} edit params & `ClientAliveInterval` and `ClientAliveCountMax` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} reload sssh & `sudo systemctl reload sshd` \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Timeout value = ClientAliveInterval * ClientAliveCountMax} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.32 cm} x{3.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{password less login setup}} \tn % Row 0 \SetRowColor{LightBackground} create key in host machine & `ssh-keygen -t rsa` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Copy key to target & `ssh-copy-id {[}target{]}` \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{copy content from .ssh/id\_rsa.pub to .ssh/authorized\_keys} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.36 cm} x{4.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{stop kernel messages}} \tn % Row 0 \SetRowColor{LightBackground} open file & `sudo cat /etc/sssd/sssd.conf` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} add in last line & \seqsplit{`ad\_gpo\_ignore\_unreadable} = True` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} restart sssd & `sudo systemctl restart sssd` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} reboot if still persists & `sudo reboot` \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.44 cm} x{4.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{output formatting}} \tn % Row 0 \SetRowColor{LightBackground} capture pattern in output & `| grep {[}pattern{]}` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} capture x lines after pattern & `| grep {[}pattern{]} -A {[}x{]}` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} capture x lines before pattern & `| grep {[}pattern{]} -B {[}x{]}` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} print only column x & `| awk '\{print \${[}x{]}\}'` \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} count output lines & `| wc -l` \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} grep curl output & `curl -v -{}-silent \seqsplit{https://google.com:443} -{}-stderr - | grep {[}pattern{]}` \tn % Row Count 14 (+ 4) \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}{edit gateway}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\#temp} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} delete existing gateway & `sudo route delete default gw 10.10.10.10 bond0.200` \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} add new gateway & `sudo route add default gw 137.10.10.10 bond0.60` \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\#permanent} \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} edit file & `sudo vi \seqsplit{/etc/sysconfig/network-scripts/ifcfg-bond0}.200` \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} restart network & `sudo /etc/init.d/network restart` \tn % Row Count 13 (+ 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}{kernel upgrade}} \tn % Row 0 \SetRowColor{LightBackground} go to yum folder & `cd /etc/yum.repos.d` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} create a bkup folder & `mkdir bkp1` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} move all repos to it & 'mv x.repo bkp1' \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} enable rhel 7 rpms & `subscription-manager repos -{}-enable rhel-7-server-rpms` \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} list available kernel & `yum list kernel` \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} install required kernel & `yum install kernel 3.10.0-1127.18.2.el7` \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} reboot & reboot \tn % Row Count 14 (+ 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}{create partition}} \tn % Row 0 \SetRowColor{LightBackground} create physical volume & `sudo pvcreate /dev/nvme0n1` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} create volume group & `sudo vgcreate vg\_data /dev/nvme0n1` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} list volume group and check & `sudo vgs` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} create logical volume & `sudo lvcreate -n lv\_docker -L +100G vg\_data` \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} list logical volume and check & `sudo lvs` \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} create a directory to map (if not exists) & `sudo mkdir /var/lib/docker` \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} check file system packages & `sudo ls -l /usr/sbin/mkfs.*` \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} & `sudo mkfs -t xfs \seqsplit{/dev/mapper/vg\_data-lv\_docker`} \tn % Row Count 19 (+ 3) % Row 8 \SetRowColor{LightBackground} add entry in /etc/fstab & `sudo sed -i '\$a \seqsplit{/dev/mapper/vg\_data-lv\_docker} /var/lib/etcd xfs defaults 0 0' /etc/fstab` \tn % Row Count 24 (+ 5) % Row 9 \SetRowColor{white} mount & `sudo mount -a` \tn % Row Count 25 (+ 1) % Row 10 \SetRowColor{LightBackground} check if mounted & `sudo df -h` \tn % Row Count 26 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.44 cm} x{4.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{delete partition}} \tn % Row 0 \SetRowColor{LightBackground} list volume group & `sudo vgs` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} remove volume group & `sudo vgremove vg\_data` \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} start disk utility & `sudo fdisk /dev/nvme0n1` \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} list partition & `p` \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} delete partition & `d` \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} save and exit & `w` \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{remove entries from /etc/fstab and unmount first.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}