What you do when you are not sure of the command you are running especially in case of complex Linux commands which use a lot of options. We use man pages to get some help in such situations. Some of the other options may include commands like ‘help‘, ‘whereis‘, and ‘whatis‘, but all have their pros and cons.
While going through man pages for options and help, the description in man pages are too lengthy to understand especially in a short span of time.
whereis Command – Find the Location of a Command
The whereis command hardly tells anything other than the location of installed binaries (commands), source code, and the manual page of the command.
$ whereis ls
whatis Command – Show Description of a Command
The whatis command gives a strict and one-liner answer which is not much helpful other than acknowledging the purpose of the command, Moreover, it never says a single word about the available options.
We have used all these options to date to solve our issue in the dilemma but here comes an interactive cheat-sheet application ‘Cheat‘ which is going to lead all the rest.
What is Linux Cheat Command?
Cheat is an interactive command-line cheatsheet application that allows you to create, view, and manage interactive cheat sheets for various commands and topics directly from the command line.
It allows you to store and organize helpful commands, tips, and examples in plain text files, referred to as cheat sheets. These cheat sheets can then be easily accessed and displayed in the terminal whenever needed.
How to Install Cheat Linux
To use the “cheat” utility, you need to have it installed on your system by simply running the following commands into your terminal:
$ cd /tmp $ wget https://github.com/cheat/cheat/releases/download/4.4.0/cheat-linux-amd64.gz $ gunzip cheat-linux-amd64.gz $ chmod +x cheat-linux-amd64 $ sudo mv cheat-linux-amd64 /usr/local/bin/cheat
You may need to change the version number (4.4.0) and the archive (cheat-linux-amd64.gz) while downloading from the releases page.
Next, add the cheat autocompletion feature to enable command-line autocompletion for different shells. To enable autocompletion, simply clone the ‘cheat.bash‘ script and copy the script to the appropriate path in your system.
$ wget https://github.com/cheat/cheat/blob/master/scripts/cheat.bash $ sudo mv cheat.bash /etc/bash_completion.d/
Optionally, you can also enable syntax highlighting, if desired. To activate the syntax highlighting feature, add a CHEATCOLORS environment variable in your ‘.bashrc‘ file.
The Cheat application default program only serves the basic and most used commands. The content of the cheat sheet resides at location ~/.cheat/ directory.
Manual Cheatsheets can be added to this location to make the application rich.
# cheat -e xyz
This will open xyz cheat sheet if available. If not it will create one and open in the default editor of your system.
How to Use Cheat Command in Linux
A tarball file may be
*.xz. So, what option is to be used to create a tar file in Linux?
$ cheat tar
I never run the dd command, no matter how much sure I am about the command before consulting and cross-checking it at more than one location.
The dd command is a versatile tool used to create byte-level copies of files, disks, partitions, or even entire storage devices. So, it is important to the use command, before running it. Incorrect usage or wrong target devices can lead to data loss or system corruption.
$ cheat dd
To get the command usage and help of uname, ip, ps, and top commands, use:
$ cheat uname $ cheat ip $ cheat top # cheat ps
cheat -l command is used to list all available cheat sheets that are accessible through the “cheat” command-line utility. It provides a convenient way to see the cheat sheets that have been installed and are ready to be accessed.
cheat -s command is used to list the location of built-in cheat sheets for all the commands.
$ cheat -s cat community: /home/tecmint/.config/cheat/cheatsheets/community personal: /home/tecmint/.config/cheat/cheatsheets/personal
This wonderful project is a life Saviour in many-a-situation, which gives you information that is required, nothing extra, nothing vague, and to the point. This is a must tool for everyone. Easy to build, easy to install, easy to run, and easy to understand, this project seems promising.
This Git project has added a wonderful gag which I am not going to explain but leave to you to interpret.
That’s all for now. I’ll be here again with another interesting article you people will love to read. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comment section below.