Learn about cheat.sh: A simple Terminal tool that provides a cheatsheet for any Linux command
Linux commands can be daunting at times due to the large number of options and parameters. Even experienced users need a quick reference from time to time. You can dig through the manual pages or search the internet, but what if there was a faster way? Enter cheat.sh, a great tool that provides instant access to cheatsheets for any Linux command.
cheat.sh is a massive, community-contributed cheatsheet collection that you can access instantly. It pulls information from sources like the Cheat Project, TLDR pages, StackOverflow, and more, and presents it to you in a clear, easy-to-read format.
The best part is that you don't need to install anything! You can use cheat.sh directly with the curl tool. If you've ever downloaded something via the terminal or interacted with a web API, you've probably used curl before. It just grabs data from URLs . And cheat.sh takes advantage of this functionality to deliver cheatsheets directly to your screen.
Getting Started with cheat.sh
The basic syntax for working with cheat.sh is simple. For example, if you want to get the cheatsheet for a command like tar, you just open a terminal and type this command:
curl cht.sh/tar
Within a split second, the tool will spit out a neatly formatted cheatsheet with popular options, usage examples, and helpful tips.
That's it! Just replace tar with whatever command is giving you trouble.
For example, to check the syntax of the find command , use:
curl cht.sh/find
This command will display detailed information on how to find files by name, type, date modified, size and even how to execute commands on the located files.
Search by keyword
You can also get a cheatsheet even if you are not sure of the exact command by searching for it using keywords. Just describe what you want to do using ~ . For example, if you want to find and delete files:
curl cht.sh/~find+delete+files
This searches through cheatsheets for topics related to find and delete, which may show you the find command, delete options, or how to use it with xargs.
Not just Linux commands – it works with programming languages too. For a quick reminder to understand Python lists, run this command:
curl cht.sh/python/list+comprehension
Want to understand Git commands? Use:
curl cheat.sh/git/merge
Make cheat.sh even more accessible
While the curl method works perfectly, you may want a more convenient way to access cheat.sh, especially if you use it frequently. You can create a simple shell function or alias in your .bashrc or .zshrc file.
Open your configuration file with any text editor like Nano (for Bash):
nano ~/.bashrc
For Zsh, run:
nano ~/.zshrc
Paste function:
cheat() { curl cheat.sh/$1 }
Finally, save and close the file, then reload it with:
source ~/.bashrc
Now, with this function defined, you just need to type:
cheat tar
This shortcut saves you a few keystrokes and makes the tool feel more integrated into your workflow.
Try cheat (installable Go version) for more configuration options!
While cheat.sh is great for quick lookups, some users may prefer more control and customization. That's where the command-line cheat tool comes in. Instead of making HTTP requests to a remote server, it maintains a local collection of cheatsheets that you can customize with personal notes, color themes, and your favorite text editor.
Note : The names can be a bit confusing – cheat.sh and cheat are two different tools. The tool we're discussing here is a nice, modern tool written in Go that you can download and install.
The easiest way to install cheats is to use the snap package manager or if you have Go set up you can install it directly using Go.
For example, on Debian/Ubuntu, run:
sudo snap install cheat
Alternatively, use Go:
go install github.com/cheat/cheat/cmd/cheat@latest
Once installed, using it is the same as cheat.sh:
cheat
You can also view your sheets and list them all with this command:
cheat -l
Another useful feature of this cheat tool is the ability to create custom cheatsheets. Here is how you can create a cheatsheet:
cheat -e new_command
This will open the default editor, where you can create a new cheatsheet for 'new_command'. The format is simple – add a short description at the top, followed by examples and explanations.
Cheat and cheat.sh are not really competitors. They are both useful for different reasons. cheat.sh (with curl) provides instant help on any machine with internet access and for quick lookups and covers tons of commands and even programming languages.
If both cheat.sh and the cheat tool seem like overkill, consider using TLDR. Short for Too Long; Didn't Read, TLDR provides simplified help pages for common commands. It's perfect for beginners who want quick answers without having to dig through complex documentation.
You should read it
- Instructions for using zforce command on Linux
- How to run 2 or more Terminal commands at the same time on Linux
- The Cat command in Linux
- How to use the which command in Linux
- How to use the Linux command line on Android with Termux
- How to fix 'apt-get: command not found' error in Linux Terminal
- How to use ss command on Linux
- How to Launch Programs from Command Line on Linux
May be interested
- How to use the Linux command line on Android with Termuxandroid is a very operating system 'capacity with more and more desktop accessibility applications. however, sometimes you want to make some things on android that can be as easy as desktop. fortunately, you can use the termux tool, which builds on the existing infrastructure and provides a command line environment that allows you to install real linux applications on your android device.
- How to back up and restore Linux Terminal historylinux maintains a backup of the command lines used in the terminal. this guide shows you how to back up a linux terminal history file. then show you how to restore those backups.
- The Cat command in Linuxthe cat command (short for 'concatenate') is one of the most frequently used commands in operating systems like linux / unix. the cat command allows users to create one or more files, view file contents, join files, and redirect output in a terminal or file.
- Make Terminal More Fun with These 8 Linux Tools!these tools will help you be more efficient, productive, and even have more fun working in terminal. let's take a look at some of our favorite command line tools!
- Common Terminal commands in Raspberry Piyou have a raspberry pi on hand, but not completely confident with linux? although the main desktop is easy to use, sometimes users need to rely on the command line entry in the terminal.
- Top 7 best Linux terminal emulatorsterminal is pre-installed in most linux distributions. however, you may not get as many customization options and advanced functionality with the default option.
- How to use Linux Terminal as a computerjoin tipsmake.com to learn how to use the terminal in linux as a computer, regardless of which distribution you are running, via the following article!
- 7 Ways to Restart Linux from Terminalrestarting linux from the terminal may seem difficult, but don't worry, it's quite simple once you know the right commands. restarting linux is necessary after updating, troubleshooting, or performing system maintenance.
- How to use the history command in Linuxas you spend more and more time in terminal sessions, you will constantly find new commands that make everyday tasks more efficient. the gnu history command is one of them.
- Basic Linux commands everyone needs to knowwhen using linux, you should also learn basic linux commands to make operations quicker and easier. here are some basic commands on linux you should know.