\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{bladabuska} \pdfinfo{ /Title (my-cheat-sheet.pdf) /Creator (Cheatography) /Author (bladabuska) /Subject (my 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}{298C0B} \definecolor{LightBackground}{HTML}{F8FBF7} \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{my Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{bladabuska} via \textcolor{DarkBackground}{\uline{cheatography.com/173176/cs/36385/}}} \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}bladabuska \\ \uline{cheatography.com/bladabuska} \\ \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 5th January, 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} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Command guide: `apt`}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Description and usage}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{`apt`}} provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like `apt-get` and `apt-cache`. \newline % Row Count 6 (+ 6) It works with Ubuntu's Advanced Packaging Tool (APT) performing such functions as {\bf{installation}} of new software packages, {\bf{upgrade}} of existing software packages, {\bf{updating}} of the package list index, and even upgrading the entire Ubuntu system. The basic command syntax is: \newline % Row Count 12 (+ 6) `\$ apt {[}options{]} command {[}packages{]}`% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Some commands require root-level privileges, in this case, prepend `sudo`to the command.} \tn \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}{options}} \tn % Row 0 \SetRowColor{LightBackground} -{}-assume-no & Assumes the answer "no" to all prompts. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -b, -{}-compile, -{}-build & Compile source packages after downloading them. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} -c, -{}-config-file & Specify a configuration file to use. The program will read the default configuration file and then this configuration file. If configuration settings need to be set before the default configuration files are parsed specify a file with the APT\_CONFIG environment variable. \tn % Row Count 19 (+ 14) % Row 3 \SetRowColor{white} -d, -{}-download-only & For any operation that would download packages, download them, but do nothing else. \tn % Row Count 24 (+ 5) % Row 4 \SetRowColor{LightBackground} -f, -{}-fix-broken & When used with {\bf{install}} or {\bf{remove}}, this option attempts to fix any broken dependencies. \tn % Row Count 29 (+ 5) % Row 5 \SetRowColor{white} -{}-force-yes & Force yes. This is a {\bf{dangerous option}} that will cause apt to continue without prompting if it is doing something potentially harmful. It should not be used except in very special situations. Using {\bf{-{}-force-yes can potentially destroy your system}}! \tn % Row Count 42 (+ 13) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{options (cont)}} \tn % Row 6 \SetRowColor{LightBackground} -{}-ignore-hold & Ignore package Holds. This causes apt-get to ignore a hold placed on a package. This may be useful in conjunction with dist-upgrade to override a large number of undesired holds. \tn % Row Count 9 (+ 9) % Row 7 \SetRowColor{white} -h, -{}-help & Show a short usage summary. \tn % Row Count 11 (+ 2) % Row 8 \SetRowColor{LightBackground} -m, -{}-ignore-missing, -{}-fix-missing & Ignores missing packages. If packages cannot be retrieved or fail the integrity check after retrieval (corrupted package files), hold back those packages and handle the result. Use of this option together with -f may produce an error in some situations. If a package is selected for installation (particularly if it is mentioned on the command-line) and it could not be downloaded then it will be silently held back. \tn % Row Count 32 (+ 21) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{options (cont)}} \tn % Row 9 \SetRowColor{LightBackground} -{}-no-download & Do not download any packages. This forces apt to use only packages it has already downloaded. \tn % Row Count 5 (+ 5) % Row 10 \SetRowColor{white} -{}-no-list-cleanup & Forbids apt to automatically manage the contents of /var/lib/apt/lists to erase obsolete files. The only reason to use this option is if you frequently change your source list. \tn % Row Count 14 (+ 9) % Row 11 \SetRowColor{LightBackground} -{}-no-remove & If any packages are to be removed apt immediately aborts without prompting. \tn % Row Count 18 (+ 4) % Row 12 \SetRowColor{white} -{}-no-upgrade & Do not upgrade packages. When used in conjunction with {\bf{install}}, no-upgrade will prevent packages listed from being upgraded if they are already installed. \tn % Row Count 26 (+ 8) % Row 13 \SetRowColor{LightBackground} -o, -{}-option & Sets an arbitrary configuration option. The syntax is {\bf{`-o Foo::Bar=bar`}}. {\bf{-o}} and {\bf{-{}-option}} can be used multiple times to set different options. \tn % Row Count 34 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{options (cont)}} \tn % Row 14 \SetRowColor{LightBackground} -{}-only-source & Only has meaning for the {\bf{source}} command. Indicates that the given source names are not to be mapped through the binary table. This means that if this option is specified, the source command will only accept source package names as arguments, rather than accepting binary package names and looking up the corresponding source package. \tn % Row Count 17 (+ 17) % Row 15 \SetRowColor{white} -{}-print-uris & Instead of fetching the files to install, their URIs are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command, the MD5 and size are not included, and it is up to the user to decompress any compressed files. \tn % Row Count 39 (+ 22) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{options (cont)}} \tn % Row 16 \SetRowColor{LightBackground} -q, -{}-quiet & Quiet. Produces output suitable for logging, omitting progress indicators. More q's will produce more quiet up to a maximum of two. You can also use -q=\# to set the quiet level, overriding the configuration file. Note that quiet level 2 implies -y, you should never use -qq without a no-action modifier such as -d, -{}-print-uris or -s as APT may decided to do something you did not expect. \tn % Row Count 20 (+ 20) % Row 17 \SetRowColor{white} -{}-reinstall & Re-Install packages that are already installed and at the newest version. \tn % Row Count 24 (+ 4) % Row 18 \SetRowColor{LightBackground} -s, -{}-simulate, -{}-just-print, -{}-dry-run, -{}-recon, -{}-no-act & Simulates operations, reporting what they would do, but make no changes to the system. \tn % Row Count 29 (+ 5) % Row 19 \SetRowColor{white} -t, -{}-target-release, -{}-default-release & This option controls the default input to the policy engine. It creates a default pin at priority 990 using the specified release string. The preferences file may further override this setting. In short, this option lets you have simple control over which distribution packages will be retrieved from. Some common examples might be -t '2.1*' or -t unstable. \tn % Row Count 47 (+ 18) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{options (cont)}} \tn % Row 20 \SetRowColor{LightBackground} -{}-trivial-only & Only perform operations that are "trivial". Logically this can be considered related to -{}-assume-yes. Where -{}-assume-yes will answer yes to any prompt, -{}-trivial-only will answer no. \tn % Row Count 10 (+ 10) % Row 21 \SetRowColor{white} -u, -{}-show-upgraded & Show upgraded packages. Print out a list of all packages that are to be upgraded. \tn % Row Count 15 (+ 5) % Row 22 \SetRowColor{LightBackground} -v, -{}-version & Show the program version. \tn % Row Count 17 (+ 2) % Row 23 \SetRowColor{white} -V, -{}-verbose-versions & Show full versions for upgraded and installed packages. \tn % Row Count 20 (+ 3) % Row 24 \SetRowColor{LightBackground} -y & Assumes the answer "yes" to any prompts, proceeding with all operations if they are possible. \tn % Row Count 25 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Examples}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{`apt update`} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Updates the list of available packages.} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`apt upgrade`} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Downloads and installs the latest packages.} \tn % Row Count 4 (+ 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}{command list}} \tn % Row 0 \SetRowColor{LightBackground} update & download package information from all configured sources. {\bf{Note:}} Other commands operate on this data, therefore, it is advisable to run this command first. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} upgrade & install available upgrades of all packages currently installed on the system from the configured sorces. New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. \tn % Row Count 15 (+ 9) % Row 2 \SetRowColor{LightBackground} \seqsplit{full-upgrade} & performs the function of {\bf{upgrade}} but will remove currently installed packages if this is needed to upgrade the system as a whole. \tn % Row Count 20 (+ 5) % Row 3 \SetRowColor{white} list & displays a list of packages satisfying certain criteria. It supports {\emph{glob patterns}} for matching package names as well as options to list {\bf{installed}} (`-{}-installed`), {\bf{upgradeable}} (`-{}-upgradeable`) or all {\bf{available versions}} (`-{}-all-versions`). \tn % Row Count 30 (+ 10) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{command list (cont)}} \tn % Row 4 \SetRowColor{LightBackground} search & search for the given {\emph{regex}} term(s) in the list of available packages and display matches. If you are looking for a package including a {\bf{specific file}} try `apt- file`. \tn % Row Count 7 (+ 7) % Row 5 \SetRowColor{white} satisfy & satisfies dependency strings, as used in Build-Depends. It also handles conflicts, by prefixing an argument with {\bf{"`Conflicts: `"}}. \tn % Row Count 12 (+ 5) % Row 6 \SetRowColor{LightBackground} autoremove & remove packages that are now no longer needed because dependencies changed or the package(s) needing them were removed in the meantime. Packages marked by the user (installed using `apt-mark`) or installed explicitly via {\bf{`install`}} are never proposed for automatic removal. \tn % Row Count 23 (+ 11) % Row 7 \SetRowColor{white} install / reinstall & installs/reinstalls one or more packages specified via {\emph{regex}}, {\emph{glob}} or {\emph{exact match}}. A {\emph{specific version}} of a package can be selected for installation by following the package name with an equals ({\bf{`=\textless{}version\textgreater{}`}}). Alternatively the version from a {\bf{specific release}} can be selected by following the package name with a forward slash and codename ({\bf{`/\textless{}codename\textgreater{}`}}) , such as {\emph{bullseye}}, {\emph{bookworm}}, {\emph{sid}} ..., or suite name ({\bf{`/\textless{}suit\textgreater{}`}}), for example, {\emph{stable}}, {\emph{testing}}, {\emph{unstable}}. This will also select versions from this release for dependencies of this package if needed to satisfy the request. {\bf{See note (**).}} \tn % Row Count 47 (+ 24) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{command list (cont)}} \tn % Row 8 \SetRowColor{LightBackground} remove & removes one or more packages specified via {\emph{regex}}, {\emph{glob}} or {\emph{exact match}}. All package data will be removed, {\emph{leaving (modified) user configuration files}} behind, in case the remove was an accident. Just issuing an installation request for the accidentally removed package will restore its function as before in that case. {\bf{See note (**).}} \tn % Row Count 13 (+ 13) % Row 9 \SetRowColor{white} purge & removes one or more packages specified via {\emph{regex}}, {\emph{glob}} or {\emph{exact match}}. All data (including user configuration files) of an installed (or already removed) packages. This does not affect any data or configuration stored in your home directory. {\bf{See note (**).}} \tn % Row Count 23 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{(*)}} This is a short list of the most commonly used commands. View documentation for a complete list. \newline {\bf{(**)}} The requested action can be overridden for specific packages by appending a plus (+) to the package name to install this package or a minus (-) to remove it.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.8 cm} p{0.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{sd}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}