cheat.sh, an online Linux commands cheat sheet

A terminal based alternative to Linux man pages

By Omid Estaji, October 23, 2022
 #Linux

Are you uncomfortable with Linux man pages? You may have some different reasons to be uncomfortable with Linux man pages, like:

  • Some man pages don't have enough examples.
  • Some man pages are very long and it's difficult to deal with them.
  • I am a beginner and I can't find correct syntax and options in man pages.
  • My english is not very good and I can't understand all descriptions in man pages.
  • I am a lazy sysadmin laugh
  • ...

So what's a good alternative to default man pages in Linux to learning commands?

In addition to these reasons, Can you find a Linux command guide without using a browser!?

Linux man pages

Man pages in Linux are very very important. In this article I don't want blaming man pages, talking about man pages' weaknesses, stop you from reading man pages or etc. I just want to talk about another useful way to learn Linux commands easily.

It's very good to read man pages, Specially when you are studing for official exams like LPIC. Man pages are not just a command line guide and they are more than it. Most man pages have been written by high level Linux users or maintainers or command creators! So man pages are, without doubt, one of the best references to learn Linux.

Simple man pages usage

There are nine sections of man pages. The -f option displays all man pages that match the specified command name:

man -f [command name]
e.g:

man -f touch
touch (1)            - change file timestamps

Then read the man page like this:

man [section number] [command name]
e.g:

man 1 touch

What is Cheat.sh

Cheat.sh is an online terminal based cheat sheet for Linux command. You can find more details about it in the Github page and cheat.sh website.

You need internet access to use cheat.sh, but you don't need any browser. You can simply use curl command to download cheat.sh and read it in your terminal.

How to use Cheat.sh

In your terminal use curl to get the cheat sheet of a Linux command line. The cheat sheet has a short description and some useful examples:

curl cheat.sh/TOPIC       show cheat sheet on the TOPIC
e.g:

curl cheat.sh/touch
# touch
# Change a file access and modification times (atime, mtime).
# More information: <https://www.gnu.org/software/coreutils/touch>.

# Create a new empty file(s) or change the times for existing file(s) to current time:
touch path/to/file

# Set the times on a file to a specific date and time:
touch -t YYYYMMDDHHMM.SS path/to/file

# Set the time on a file to one hour in the past:
touch -d "-1 hour" path/to/file

# Use the times from a file to set the times on a second file:
touch -r path/to/file1 path/to/file2

# Create multiple files:
touch path/to/file{1,2,3}.txt