First, what is cheat?
Cheat is an interactive cheat sheet application that is distributed to Linux command line users under the GNU General Public License. Simply put, it does not provide any additional extraneous information, only by using an instance to tell you how a command parameter is used.
Second, install cheat in Redhat and CentOS system:
Cheat has two main dependencies on Python and Pip
1. Install Python, pip
Yum install python python-pip-install --upgrade pip (update pip to latest version)
Note: Pip is a handy Python third-party package installer.
2. Download and install cheat
Currently you can only download cheat from git, so install the GIT package first:
Yum Install git-y
Use Pip to install the Python dependency package that you need:
Install docopt pygments
Next, copy the Cheat git library:
# git clone https://github.com/chrisallenlane/cheat.git
Go to the Cheat directory and run the setup.py script installation:
Install
When the installation is complete, run cheat-v to see the current version number.
Third, some configuration settings of cheat:
1, you must set the editor environment variable in the ~/.BASHRC file, open the user. bashrc file, add the following line to save the exit:
Export Editor=/usr/bin/vim
Note: You can also use your favorite editor to replace Vim.
2, add cheat Auto-completion feature, to ensure that the command line under the different interpreter automatic completion. Method: Clone the Cheat.bash script down and copy it to the correct path on your system.
wget https://Github.com/chrisallenlane/cheat/raw/master/cheat/autocompletion/cheat.bash CP cheat.bash/etc/bash_completion.d/#mac默认的配置补全配置文件放置的地方为:/usr/local/cellar/cheat/2.1.22/etc/bash _completion.d
The rest of the interpreter's auto-complete script is here:
Https://github.com/chrisallenlane/cheat/tree/master/cheat/autocompletion
3. Let syntax highlight (optional):
Add the following environment variable in the. bashrc file
Export cheatcolor=true
4. Add more command parameters:
Cheat provides only the most basic and commonly used commands by default. Cheat the contents of the cheat sheet are saved in the ~/.cheat/directory, we can manually add the contents of the cheat sheet in this directory, so cheat will be more powerful.
# CHEAT-E XYZ
This will open the XYZ cheat sheet if the corresponding Cheat-sheet is available. Otherwise cheat will create a cheat-sheet.
Use the keyword search cheat sheet to see the built-in cheat sheet that contains all the commands.
# cheat-D/root/. Cheat/usr/lib/python2. 7/site-packages/cheat/cheatsheets
Copy the built-in cheat sheet to your local directory.
CP /usr/lib/python2. 7/site-packages/cheat/cheatsheets/* /root/.cheat/
Iv. examples of some cheat commands
Example:
$ cheat Find
# toFindFiles by Case-insensitive extension (ex:. jpg,. JPG,. jpg):Find. -iname"*.jpg"# toFindDirectories:Find. -type d# toFindFiles:Find. -Type F # toFindfiles by octal permission:Find. -type F-perm777# toFindfiles with setuid bit set:Find. -xdev \ (-perm-4000\)-type F-print0 |Xargs-0 ls-l# toFindFiles with extension'. txt'and remove them:Find./path/-name'*.txt'-execRM '{}'\;# toFindFiles with extension'. txt'and look forAstringinto them:Find./path/-name'*.txt'|Xargs grep 'string'# toFindFiles with size bigger than5Mb andSortthem by size:Find. -size +5m-type f-print0 |Xargs-0 ls-ssh |Sort-z# toFindFiles Bigger Thank2MB and list them:Find. -type f-size +20000k-execls-LH {} \; |awk '{print $9 ":" $ $}'# toFindFiles Modified Morethan7Days ago and ListfileInformationFind. -type F-mtime +7d-ls# toFindSymlinks owned by a user and listfileInformationFind. -type L--user=username-ls# to search forand Delete empty directoriesFind. -type d-empty-execrmdir{} \;# to search forDirectories named build at a max depth of2DirectoriesFind. -maxdepth2-name Build-type d# to search all filesW.H.O.is notinch. Git directoryFind. ! -iwholename'*.git*'-Type F # toFindAll files, which has the same node (hard link) as My_file_hereFind. -type F-samefile My_file_here2>/dev/NULL# toFindAll FilesinchThe current directory and modify their permissionsFind. -type f-execchmod 644{} \;
Installing cheat on a Mac
Install Cheat
Then follow the previous instructions to configure
Several cheatsheet documents are recommended for download:
Red Hat Linux Command cheat sheet
Linux Training College Cheat sheet
Linoxide Cheat Sheet
Loggly Cheat Sheet
Cheatography Cheat Sheet
Reference Documentation:
Linux Command parameter Usage query tool: Cheat
Cheat–an Ultimate Command line ' cheat-sheet ' for Linux beginners and Administrators
Linux and Mac command parameter Usage Query tool: Cheat