Cheat – A collection of practical Linux command examples

Many of us very often checks Man Pages to know about command switches (options), it shows you the details about command syntax, description, details, and available switches but it doesn’t has any practical examples. Hence, we are face some trouble to form a exact command format which we need.

I suggest you  a better solution, to check about cheat utility.

What is Cheat

Cheat allows you to create and view interactive cheatsheets 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.

How to install Cheat

Cheat package was developed using python, so install pip package to install cheat on your system.

For Debian/Ubuntu, use apt-get command or apt command to install pip.

[For Python2]
$ sudo apt install python-pip python-setuptools

[For Python3]
$ sudo apt install python3-pip

pip doesn’t shipped with RHEL/CentOS system official repository so, enable EPEL Repository and use YUM command to install pip.

$ sudo yum install python-pip python-devel python-setuptools

For Fedora system, use dnf Command to install pip.

[For Python2]
$ sudo dnf install python-pip

[For Python3]
$ sudo dnf install python3

For Arch Linux based systems, use Pacman Command to install pip.

[For Python2]
$ sudo pacman -S python2-pip python-setuptools

[For Python3]
$ sudo pacman -S python-pip python3-setuptools

For openSUSE system, use Zypper Command to install pip.

[For Python2]
$ sudo pacman -S python-pip

[For Python3]
$ sudo pacman -S python3-pip

pip is a python module bundled with setuptools, it’s one of the recommended tool for installing Python packages in Linux.

$ sudo pip install cheat

How to use Cheat

Run cheat followed by corresponding command to view the cheatsheet, For demonstration purpose, we are going to check about tar command examples.

$ cheat tar
# To extract an uncompressed archive:
tar -xvf /path/to/foo.tar

# To create an uncompressed archive:
tar -cvf /path/to/foo.tar /path/to/foo/

# To extract a .gz archive:
tar -xzvf /path/to/foo.tgz

# To create a .gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/

# To list the content of an .gz archive:
tar -ztvf /path/to/foo.tgz

# To extract a .bz2 archive:
tar -xjvf /path/to/foo.tgz

# To create a .bz2 archive:
tar -cjvf /path/to/foo.tgz /path/to/foo/

# To extract a .tar in specified Directory:
tar -xvf /path/to/foo.tar -C /path/to/destination/

# To list the content of an .bz2 archive:
tar -jtvf /path/to/foo.tgz

# To create a .gz archive and exclude all jpg,gif,... from the tgz
tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/

# To use parallel (multi-threaded) implementation of compression algorithms:
tar -z ... -> tar -Ipigz ...
tar -j ... -> tar -Ipbzip2 ...
tar -J ... -> tar -Ipixz ...

Run the following command to see what cheatsheets are available.

$ cheat -l

Navigate to help page for more details.

$ cheat -h

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

One Comment on “Cheat – A collection of practical Linux command examples”

Leave a Reply

Your email address will not be published. Required fields are marked *