cheat--gives Linux beginners and administrators an ultimate command line "cheat sheet"

Source: Internet
Author: User
Tags python script

cheat--gives Linux beginners and administrators an ultimate command line "cheat sheet"

What do you do when you're not sure what commands you're running, especially complex commands that use a lot of options? In this case, we use the man pages to get help. There are other options that may include commands suchas ' help ', 'whereis' and 'whatis'. But all of these have both advantages and disadvantages.

When we browse the man pages to see the options and help, the description is too lengthy and we can't understand it in a short time.

Linux Mans Pages

Likewise, the' help ' command may not give you the answers you expect.

Help Command

The 'whereis' command hardly gives you any information except the location of the binaries (which may sometimes be important)

Whereis Command

The 'whatis' command gives a very strict answer, and it doesn't help much except to say what the query command does. Moreover, it never describes the available options.

Whatis Command

We have used all of the above options until we have solved the problem in a difficult situation, but now we have an interactive memo application 'cheat', which will stand out from the rest of the commands.

What is cheat?

Cheat is an interactive cheat sheet application that is distributed to Linux command line users under the GNU General Public License. It provides a display of Linux command use cases, including all of the options and short but understandable features of the command.

Cheat: provides simple command options

Installing ' Cheat ' in a Linux system

'Cheat' has two main dependencies-'python' and 'pip', before installing 'Cheat', make sure your system has Python and Pip installed.

Install Python

    1. # Apt-get Install Python (Debian-based system)
    2. # yum Install Python (based on the small Red Hat system)

Install Pip

    1. # Apt-get Install Python-pip (Debian-based system)
    2. # Yum Install Python-pip (based on the small Red Hat system)

Note: Pip is a simple installation replacement and a Python third-party Package installer with great improvements.

Download and install cheat

We will download ' Cheat ' via git and make sure you install the ' git ' package if it is not best to install it.

    1. # apt-get Install git (Debian-based system)
    2. # yum Install git (based on a small Red Hat system)

Next, install the required Python dependency package by running the following command.

    1. # pip Install docopt pygments

Now, copy the Cheat git library

    1. # git clone https://github.com/chrisallenlane/cheat.git

Go to the Cheat directory and run 'setup.py' (a Python script).

    1. # CD Cheat
    2. # python setup.py Install

If the installation is successful, you will be able to see the cheat version installed on the system.

    1. # cheat-v
    2. Cheat 2.0. 9

Some necessary configurations of cheat

You must set the 'EDITOR' environment variable in the ' ~/.BASHRC ' file, open the user '. BASHRC' file, and add the following line to the inside:

    1. Export EDITOR = /usr/bin/nano

You can use your favorite editor instead of 'nano'. Save the file and then exit and log in again to make sure the changes take effect.

Next, add the cheat auto-completion feature to ensure that the command line is automatically complete under different interpreters. To get to this feature, simply clone the 'cheat.bash' script down and copy it to your system's correct path.

    1. # wget Https://github.com/chrisallenlane/cheat/raw/master/cheat/autocompletion/cheat.bash
    2. # MV Cheat.bash/etc/bash_completion.d/

Note: The team has uploaded automatic completion scripts for other interpreters on Git, which can be cloned and used on different interpreters. Use the links below to find the automatic completion script for the remaining interpreters:

    • Auto completion Script for Various shells

Not only that, you can also use syntax highlighting if you need to. To do this, add the 'cheatcolors' environment variable in your '. BASHRC' file.

    1. Export Cheatcolor=true

The Cheat app provides only the most basic and commonly used commands by default. The contents of the cheat cheat sheet are saved in ~/.cheat/. Directory, we can manually add the contents of the cheat sheet in this directory, so that our cheat application will be more powerful.

    1. # CHEAT-XYZ

This will open the XYZ cheat sheet, and if not, create one. The cheat sheet will be opened using the default editor set in the . BASHRC , which is set by the default editor. BASHRC .

Use of some cheat commands

A package can be *.gz, *.bz2, *.zip, *.XZ, but what are the options?

Tar command options

I never use the dd command until I have consulted and checked in a different place, and before that, no matter how sure I am about the command. Now, things are going to be a lot easier.

DD Command Options

'uname' command help

uname command Selection

A short ifconfig command Operation tutorial

Ifconfig command Options

The ' top ' command is one of the most important commands for administrators and ordinary users.

Top command Options

Let's cheat the cheat order, how (though it doesn't make sense)? Getting a list of available commands is actually a cheat memo installed on your system.

List all Linux commands

Use keywords to search for cheat sheets.

Search Cheat Sheet

Take a look at the built-in cheat sheets that contain all the commands.

    1. $ cheat -d
    2. /Home/avi/. Cheat
    3. /usr/local/Lib/python2. 7/Dist-packages/cheat/cheatsheets

Copy the built-in cheat sheet to your local directory.

    1. # cp/usr/local/lib/python2.7/dist-packages/cheat/cheatsheets/*/home/avi/.cheat/

Conclusion

This awesome tool in many cases serves as the "savior" role, giving you the information you need, information that is not redundant, not blurred, and, conversely, hitting the point. This is a tool that everyone will need, very simple to create, install, use and understand, the tool is promising.

This git repository has added a wonderful gag, and I'm not going to explain it here, but leave it to everyone to explain.

Linux Gag

Well, the article is coming to an end, and I'm going to come back here with the next interesting article you like, so keep an eye on us all the time. Don't forget to leave us your valuable feedback in the comments section below.

Original link: http://linux.cn/article-3760-1.html

cheat--gives Linux beginners and administrators an ultimate command line "cheat sheet"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.