{"id":7295,"date":"2020-11-28T13:44:45","date_gmt":"2020-11-28T10:44:45","guid":{"rendered":"https:\/\/kifarunix.com\/?p=7295"},"modified":"2024-03-14T23:40:58","modified_gmt":"2024-03-14T20:40:58","slug":"install-cheat-command-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-cheat-command-on-ubuntu-20-04\/","title":{"rendered":"Install Cheat Command on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this tutorial, you will learn how to install cheat command on Ubuntu 20.04. <code><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/cheat\/cheat\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Cheat<\/a><\/code>&nbsp;is a Python based command line utility that <em>allows you to create and view interactive cheat sheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Cheat Command on Ubuntu 20.04<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Run System Update<\/h3>\n\n\n\n<p>Update your system package cache;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Python PIP on Ubuntu 20.04<\/h3>\n\n\n\n<p>Cheat is Python based program. As such, its installation has to be done through the use the Python package manager, PIP. Install Python pip on Ubuntu 20.04 by executing the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo apt install python3-pip<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Cheat Command<\/h3>\n\n\n\n<p>Once Python package manager is installed, you can then install cheat command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pip3 install cheat<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Collecting cheat\n  Downloading cheat-2.5.1.tar.gz (82 kB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 82 kB 243 kB\/s \nCollecting docopt&gt;=0.6.1\n  Downloading docopt-0.6.2.tar.gz (25 kB)\nCollecting pygments&gt;=1.6.0\n  Downloading Pygments-2.7.2-py3-none-any.whl (948 kB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 948 kB 403 kB\/s \nCollecting termcolor&gt;=1.1.0\n  Downloading termcolor-1.1.0.tar.gz (3.9 kB)\nBuilding wheels for collected packages: cheat, docopt, termcolor\n  Building wheel for cheat (setup.py) ... done\n  Created wheel for cheat: filename=cheat-2.5.1-py3-none-any.whl size=107856 sha256=1ae35293a86ace4491b98c4ec772372fb65cdd6da9407031f953e5f9483d37b1\n  Stored in directory: \/root\/.cache\/pip\/wheels\/a6\/2d\/b2\/8bd4534364edd5c6940fc495d595d949a2310e982e89865e95\n  Building wheel for docopt (setup.py) ... done\n  Created wheel for docopt: filename=docopt-0.6.2-py2.py3-none-any.whl size=13704 sha256=dd271e68af7385449d4560461bc4136f01ba7f869e63e3a48d3cad21bd209db5\n  Stored in directory: \/root\/.cache\/pip\/wheels\/56\/ea\/58\/ead137b087d9e326852a851351d1debf4ada529b6ac0ec4e8c\n  Building wheel for termcolor (setup.py) ... done\n  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=2d9d7fe0ba735b776c423aab78232847c5a219a3d54833938440ebf3241b8de0\n  Stored in directory: \/root\/.cache\/pip\/wheels\/a0\/16\/9c\/5473df82468f958445479c59e784896fa24f4a5fc024b0f501\nSuccessfully built cheat docopt termcolor\nInstalling collected packages: docopt, pygments, termcolor, cheat\nSuccessfully installed cheat-2.5.1 docopt-0.6.2 pygments-2.7.2 termcolor-1.1.0<\/code><\/pre>\n\n\n\n<p>Cheat is now installed successfully on Ubuntu 20.04;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>cheat 2.5.1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Set Default Cheat Text Editor <\/h3>\n\n\n\n<p>Once the installation is done, you need to define the default text editor for your cheat program. By default, Cheat used the editor defined by the EDITOR environment variable.<\/p>\n\n\n\n<p>For example, to check what value is assigned to the EDITOR environment variable;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo $EDITOR<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/bin\/vim<\/code><\/pre>\n\n\n\n<p>Or;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>printenv EDITOR<\/code><\/pre>\n\n\n\n<p>If the EDITOR environment variable has not been assigned any editor, you can simply assign it. For example, if you want to use vim editor as your default text editor, run the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export EDITOR=`which vim`<\/code><\/pre>\n\n\n\n<p>When you run cheat command, it should now use vim editor to manage your cheatsheets.<\/p>\n\n\n\n<p>To permanently set your EDITOR environment variable, you can enter the line above into the <code>~\/.bashrc<\/code> or <code>~\/.zshrc<\/code> file depending to the shell you are using;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo \"export EDITOR=<code>which vim<\/code>\" &gt;&gt; ~\/.bashrc\nsource ~\/.bashrc<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo \"export EDITOR=<code>which vim<\/code>\" &gt;&gt; ~\/.zshrc\nsource ~\/.zshrc<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Set Cheat Default Cheatsheets Directory<\/h3>\n\n\n\n<p>By default, cheatsheets are stored under, <code><strong>$HOME\/.cheat\/<\/strong><\/code> directory. If you want to store your cheats in a different directory, you need to set the directory as the value for the <code><strong>DEFAULT_CHEAT_DIR<\/strong><\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export DEFAULT_CHEAT_DIR=$HOME\/Documents\/cheats<\/code><\/pre>\n\n\n\n<p>This sets the default directory for the cheats to <code><strong>$HOME\/Documents\/cheats<\/strong><\/code>.<\/p>\n\n\n\n<p>You can permanently set this in ~\/.zshrc or ~\/.bashrc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cheat Command Usage<\/h3>\n\n\n\n<p>To see how to use cheat command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat --help<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Usage:\n  cheat &lt;cheatsheet&gt;\n  cheat -e &lt;cheatsheet&gt;\n  cheat -s &lt;keyword&gt;\n  cheat -l\n  cheat -d\n  cheat -v\n\nOptions:\n  -d --directories  List directories on $CHEAT_PATH\n  -e --edit         Edit cheatsheet\n  -l --list         List cheatsheets\n  -s --search       Search cheatsheets for &lt;keyword&gt;\n  -v --version      Print the version number<\/code><\/pre>\n\n\n\n<p><a aria-label=\"Example Usage of Cheat command (opens in a new tab)\" href=\"https:\/\/github.com\/cheat\/cheat#usage\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Example Usage of Cheat command<\/a><\/p>\n\n\n\n<p>To view a cheatsheet:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat tar      # a \"top-level\" cheatsheet\ncheat foo\/bar  # a \"nested\" cheatsheet<\/code><\/pre>\n\n\n\n<p>To edit a cheatsheet:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -e tar     # opens the \"tar\" cheatsheet for editing, or creates it if it does not exist\ncheat -e foo\/bar # nested cheatsheets are accessed like this<\/code><\/pre>\n\n\n\n<p>To view the configured cheatpaths:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -d<\/code><\/pre>\n\n\n\n<p>To list all available cheatsheets:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -l<\/code><\/pre>\n\n\n\n<p>To list all cheatsheets that are tagged with &#8220;networking&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -l -t networking<\/code><\/pre>\n\n\n\n<p>To list all cheatsheets on the &#8220;personal&#8221; path:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -l -p personal<\/code><\/pre>\n\n\n\n<p>To search for the phrase &#8220;ssh&#8221; among cheatsheets:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -s ssh<\/code><\/pre>\n\n\n\n<p>To search (by regex) for cheatsheets that contain an IP address:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -r -s '(?:[0-9]{1,3}\\.){3}[0-9]{1,3}'<\/code><\/pre>\n\n\n\n<p>Flags may be combined in intuitive ways. Example: to search sheets on the &#8220;personal&#8221; cheatpath that are tagged with &#8220;networking&#8221; and match a regex:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cheat -p personal -t networking --regex -s '(?:[0-9]{1,3}\\.){3}[0-9]{1,3}'<\/code><\/pre>\n\n\n\n<p>And that marks the end of our tutorial.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reference<\/h3>\n\n\n\n<p><a aria-label=\"Github cheat\/cheatsheets (opens in a new tab)\" href=\"https:\/\/github.com\/cheat\/cheat\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Github cheat\/cheatsheets<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/create-user-account-using-useradd-adduser-commands-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Create User Account using useradd\/adduser commands in Linux<\/a><\/p>\n\n\n\n<p><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-and-setup-zsh-and-oh-my-zsh-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Install and Setup ZSH and Oh-My-Zsh on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/installing-perf-performance-analysis-tool-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Installing Perf Performance Analysis Tool on CentOS 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/run-only-specific-commands-with-sudo-in-linux\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"rank-math-link\">Run only Specific Commands with sudo in Linux<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to install cheat command on Ubuntu 20.04. Cheat&nbsp;is a Python based command line utility that allows you to<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[49,121],"tags":[2906,2908,2907,2904,2905,1200,2909],"class_list":["post-7295","post","type-post","status-publish","format-standard","hentry","category-command-cheatsheets","category-howtos","tag-cheat-command","tag-cheat-command-line","tag-cheatsheets","tag-install-cheat-command-linux","tag-install-cheat-command-ubuntu-20-04","tag-ubuntu-20-04","tag-ubuntu-install-cheat-sheets-command","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7295"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=7295"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7295\/revisions"}],"predecessor-version":[{"id":21552,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7295\/revisions\/21552"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=7295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=7295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=7295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}