Table of Contents
Linux Cheat Command" >Linux Cheat Command
Installing the Cheat program in Linux" >Installing the Cheat program in Linux
列出 Cheat 支持项目" >列出 Cheat 支持项目
使用 Cheat 查看 Linux 命令" >使用 Cheat 查看 Linux 命令
这并不是作弊" >这并不是作弊
Home System Tutorial LINUX 'Cheating': Just know this one Linux command is enough

'Cheating': Just know this one Linux command is enough

Feb 15, 2024 pm 03:00 PM
linux linux tutorial linux system linux command shell script embeddedlinux Getting started with linux linux learning

There is a wealth of information about Linux and open source on the Internet, but when you want to learn more, you usually need a handy document. In Unix systems before Linux appeared, there were already man (abbreviation for "manual") and info commands, both of which can display commands, configuration files, system calls, etc. Official project documentation.

“作弊”:只需要知道这一个 Linux 命令就够了

There is some debate as to whether the man and info pages are useful reminders for users familiar with using the tool, or provide an introduction for first-time users. But anyway, the man and info pages describe the tools and how to use them, and rarely cover specific tasks and how to complete them. It is for this reason that the cheat command was developed.

For example, imagine that you can't remember how to decompress the tar archive file🔗 opensource.com. The man page will show you all the options, but you need to convert this information into commands:

tar-A [OPTIONS] ARCHIVE ARCHIVE
tar-c [-f ARCHIVE] [OPTIONS] [FILE...]
tar-d [-f ARCHIVE] [OPTIONS] [FILE...]
tar-t [-f ARCHIVE] [OPTIONS] [MEMBER...]
tar-r [-f ARCHIVE] [OPTIONS] [FILE...]
tar-u [-f ARCHIVE] [OPTIONS] [FILE...]
tar-x [-f ARCHIVE] [OPTIONS] [MEMBER...]
Copy after login

This is indeed what some users need, but it also confuses some users. In contrast, the cheat command lists commonly used commands:

$ cheat tar
#To extract an uncompressed archive:
tar-xvf /path/to/foo.tar
#To extract a .tarin specified Directory:
tar-xvf /path/to/foo.tar-C /path/to/destination/
#To create an uncompressed archive:
tar-cvf /path/to/foo.tar/path/to/foo/
#To extract a .tgz or.tar.gz archive:
tar-xzvf /path/to/foo.tgz
tar-xzvf /path/to/foo.tar.gz
[...]
Copy after login

This is really a timely help!

Linux Cheat Command

cheat command is a utility that can be used to search and display usage examples of the command you want to use. As with most Unix commands, there are several different implementations of the same concept, including one written in Go - github.com and one I help maintain in just 100 lines of Bash - gitlab Two versions of .com.

To install the Go version, download the latest version🔗 github.com and put it in a certain path🔗 opensource.com, such as ~/.local/bin/ or /usr/local/bin. If installing the Bash version, download the latest version and run the install-cheat.sh script:

$ sh ./install-cheat.sh
Copy after login

If you need to configure and install, please use Autotools🔗 opensource.com (Autotools):

$ aclocal ; autoconf
$ automake --add-missing ; autoreconf
$ ./configure --prefix=$HOME/.local
$ make
$ make install

Copy after login

Installing the Cheat program in Linux

Cheat is just a plain text file containing commonly used commands. The program is available at github.com/cheat/cheatsheets🔗 github.com. The Go version will automatically download the support list for you when you run the command for the first time. If you are using the Bash version, use the --fetch option to download the support list:

$ cheat --fetch
Copy after login

Like man, you can have multiple cheat sheet collections on your system. The Go version of cheat uses YAML's opensource.com configuration file to define the location of each collection. The Bash version has a path defined during the installation process and by default downloads the github.com/cheat/cheatsheets🔗 github.com collection as well as opensource.com🔗 Opensource.com's own gitlab.com/opensource.com/cheatsheets🔗 gitlab.com collection.

列出 Cheat 支持项目

使用 --list 选项即可查看 cheat 支持的项目:

$ cheat --list
7z
ab
acl
alias
ansi
ansible
ansible-galaxy
ansible-vault
apk
[...]
Copy after login

使用 Cheat 查看 Linux 命令

使用 cheat 查看命令如同使用 man 和 info 查看一样简单。只需要输入你需要查询的命令即可:

$ cheat alias
#To show a list of your current shell aliases:
alias
#Toalias`ls -l` to `ll`:
alias ll='ls -l'
Copy after login

默认情况下,cheat 命令会使用你的 环境变量🔗 opensource.com PAGER 中指定的分页器。你可以在运行 cheat 命令前改写 PAGER 变量值,暂时修改环境变量。

$ PAGER=most cheat less
Copy after login

如果你只是想在没有 PAGER 的情况下将 cheat 输出🔗 opensource.com 到终端里,在 Bash 版中有 --cat 选项可以使用:

$ cheat --catless
Copy after login

这并不是作弊

cheat 系统抓住了要害,你不必拼凑有关如何使用命令的线索,你只需按照示例进行操作即可。当然,对于复杂的命令,它不是深入研究实际文档的捷径,但为了快速借用,它还是可以的。

甚至你可以通过将文件放入其中一个备忘单集合中,来创建自己的备忘单。好消息是,因为这些项目是开源的,所以你可以将你的个人备忘单贡献给 GitHub 集合。另一个好消息是,当有新的 opensource.com🔗 opensource.com 备忘单🔗 opensource.com 版本发布时,我们将从现在开始包含纯文本版本,以便你可以将其添加到你的收藏中。

该命令称为 “作弊(cheat)”,但正如任何 Linux 用户都会向你保证的那样,它实际上并不是作弊。它只是以开源的方式工作得更巧妙。

The above is the detailed content of 'Cheating': Just know this one Linux command is enough. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

See all articles