\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{steps} \pdfinfo{ /Title (windows-os-basic-cli-commands.pdf) /Creator (Cheatography) /Author (steps) /Subject (Windows OS Basic CLI 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}{000000} \definecolor{LightBackground}{HTML}{F7F7F7} \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{Windows OS Basic CLI Commands Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{steps} via \textcolor{DarkBackground}{\uline{cheatography.com/76111/cs/18824/}}} \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}steps \\ \uline{cheatography.com/steps} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 14th February, 2019.\\ Updated 14th February, 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{tabularx}{17.67cm}{x{1.8557 cm} x{7.5915 cm} x{7.4228 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Commands}} \tn % Row 0 \SetRowColor{LightBackground} Help or /? & gets available commands, or displays help info for commands & `echo /?` \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} echo & prints following info to STDOUT & `echo hello world` \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} type & prints file contents to STDOUT & `type helloWorld.txt` \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \textgreater{} & redirect; sends output to file & `command \textgreater{} filename` \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \textgreater{}\textgreater{} & append & `command \textgreater{}\textgreater{} filename ` \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \textless{} & type's {\emph{filename}} and sends text to {\emph{command}} & `command \textless{} filename` \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} 2\textgreater{} & sends error message to file & `echpo 2\textgreater{} error.txt` \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} | & pipes output from left to right & `command1 | command 2` \tn % Row Count 19 (+ 2) % Row 8 \SetRowColor{LightBackground} \seqsplit{hostname} & displays hostname of system & `hostname` \tn % Row Count 21 (+ 2) % Row 9 \SetRowColor{white} ver & displays windows version & `ver` \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} vol & displays disk volume label and serial number & `vol` \tn % Row Count 26 (+ 3) % Row 11 \SetRowColor{white} \seqsplit{systeminfo} & config information for local or remote machine; {\bf{includes service pack levels}} & `systeminfo` \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{1.8557 cm} x{7.5915 cm} x{7.4228 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Commands (cont)}} \tn % Row 12 \SetRowColor{LightBackground} set & used to manage variables & `set \seqsplit{mySweetVariable=whatItEquals`} \tn % Row Count 2 (+ 2) % Row 13 \SetRowColor{white} cd & "change directory"; displays the name of current or changes directory & ` cd c:\textbackslash{} ` \tn % Row Count 6 (+ 4) % Row 14 \SetRowColor{LightBackground} dir & "directory"; used to display contents of files and sub directories of current working directory & `dir c:\textbackslash{}myDirectory` \tn % Row Count 12 (+ 6) % Row 15 \SetRowColor{white} \seqsplit{mkdir/md} & make directory & `md c:\textbackslash{}myDirectory\textbackslash{}childDirectory` \tn % Row Count 14 (+ 2) % Row 16 \SetRowColor{LightBackground} \seqsplit{rmdir/rd} & remove directory & `rd c:\textbackslash{}myDirectory\textbackslash{}childDirectory` \tn % Row Count 16 (+ 2) % Row 17 \SetRowColor{white} more & prints to STDOUT, but one screen at a time & `more \seqsplit{reallyLongText.txt`} \tn % Row Count 19 (+ 3) % Row 18 \SetRowColor{LightBackground} copy & copies one or more files to another location & `copy file.txt c:\textbackslash{}newLocation\textbackslash{}file.txt` \tn % Row Count 22 (+ 3) % Row 19 \SetRowColor{white} xcopy & copies files and filders & `xcopy c:\textbackslash{}misplacedDirectory c:\textbackslash{}correct\textbackslash{}rightSpotDirectory` \tn % Row Count 26 (+ 4) % Row 20 \SetRowColor{LightBackground} move & moves files from one folder till another & `move .\textbackslash{}document.txt c:\textbackslash{}document.txt` \tn % Row Count 29 (+ 3) % Row 21 \SetRowColor{white} \seqsplit{ren/rename} & rename a file or files & `ren monday.txt Tuesday` \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{1.8557 cm} x{7.5915 cm} x{7.4228 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Commands (cont)}} \tn % Row 22 \SetRowColor{LightBackground} del & deletes one or more files & `del basura.txt` \tn % Row Count 2 (+ 2) % Row 23 \SetRowColor{white} find & search for a text string in a file \& display all the lines where it is found & `find \textbackslash{}I "hard to find text` \tn % Row Count 7 (+ 5) % Row 24 \SetRowColor{LightBackground} \seqsplit{findstr} & search for a text string in a file \& display all the lines where it is found; supports regular expressions & `findstr /r "\textasciicircum{}{[}1-9{]}{[}0-9{]}" sales.txt` \tn % Row Count 13 (+ 6) % Row 25 \SetRowColor{white} \seqsplit{attrib} & displays or changes files attributes {\bf{if a file has the System or Hidden attribute set, you must clear that attribute before you can change any other attributes}} & `attrib +H +S \seqsplit{makeMeHiddenAndSystem}.txt` \tn % Row Count 23 (+ 10) % Row 26 \SetRowColor{LightBackground} \seqsplit{icacls} & change file and folder permissions - display or modify Access Control Lists (ACLs) for files and folders {\bf{RTFM (Read The F@\#\$ing Manual)}} & Read the Damned Help File \tn % Row Count 31 (+ 8) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{1.8557 cm} x{7.5915 cm} x{7.4228 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Commands (cont)}} \tn % Row 27 \SetRowColor{LightBackground} fc & compare the contents of two files or sets of files; display any lines which do NOT match & `fc fileOne.txt fileTwo.txt` \tn % Row Count 5 (+ 5) % Row 28 \SetRowColor{white} comp & compare two files (or sets of files) ; display items that do not match & `comp fileOne fileTwo` \tn % Row Count 9 (+ 4) % Row 29 \SetRowColor{LightBackground} \seqsplit{shutdown} & shutdown or restart a computer & `shutdown /t 120` \tn % Row Count 11 (+ 2) % Row 30 \SetRowColor{white} \seqsplit{tasklist} & displays all running applications and services with their Process ID (PID) This can be run on either a local or a remote computer & `tasklist /FI "IMAGENAME eq Calculator.exe"` \tn % Row Count 19 (+ 8) % Row 31 \SetRowColor{LightBackground} sc & Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE. The command options for SC are case sensitive & `sc query type= driver` {\bf{RTFM}} \tn % Row Count 26 (+ 7) % Row 32 \SetRowColor{white} net & manage network resources & `net group "administrators' /domain` {\bf{RTFM}} \tn % Row Count 29 (+ 3) % Row 33 \SetRowColor{LightBackground} \seqsplit{ipconfig} & displays network adaptor information & `ipconfig /all` \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{1.8557 cm} x{7.5915 cm} x{7.4228 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Commands (cont)}} \tn % Row 34 \SetRowColor{LightBackground} ping & test a network connection - if successful, ping returns the ip address & `ping -n 1 8.8.8.8` \tn % Row Count 4 (+ 4) % Row 35 \SetRowColor{white} \seqsplit{tracert} & "tracer route" tracks path to destination and counts hops (can also resolve ip addresses if used on domain names) & `tracert WRKST002` \tn % Row Count 11 (+ 7) % Row 36 \SetRowColor{LightBackground} \seqsplit{netstat} & display current TCP/IP network connections and protocol statistics & `netstat -a` {\bf{RTFM}} \tn % Row Count 15 (+ 4) % Row 37 \SetRowColor{white} time & displays time & `time /T` \tn % Row Count 16 (+ 1) % Row 38 \SetRowColor{LightBackground} date & displays date & `date /T` \tn % Row Count 17 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{17.67cm}}{Success and failures for commands are based on the Exit Code of the command. \newline In most cases the Exit Code is the same as the ErrorLevel \newline Numeric handles: \newline \newline STDIN = 0 Keyboard input \newline STDOUT = 1 Text output \newline STDERR = 2 Error text output \newline UNDEFINED = 3-9 \newline \newline {\bf{{\emph{ Make Macro For Answer Sheet Creation }}}} \newline \newline `doskey banner=(echo. \textasciicircum{}\& echo *** Step \$* *** \textasciicircum{}\& echo.) \textasciicircum{}\textgreater{}\textasciicircum{}\textgreater{} c:\textbackslash{}location\textbackslash{}answers.txt` \newline \newline {\bf{MAKE SURE YOU PUT YOUR ANSWER FILE IN THE RIGHT PLACE}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \end{document}