Matthew McCorkle

Day 8 - Cheat.sh - 100 tools in 100 days!

1 . Introduction
2 . My Setup
3 . What is Cheat.sh?
4 . Why use Cheat.sh?
5 . How to use Cheat.sh?
6 . Summary


This post is designed to teach you what the tool Cheat.sh accomplishes and how to use it.


1. Introduction

Disclaimer: This is not a Kali or Parrot default tool, however, I believe it is an excellent resource for when working in the terminal.

Welcome to the eighth blog post of 100 tools in 100 days.
In this post and concurrent posts, I will introduce you to a tool in Kali or Parrot Linux.
I will discuss use cases for the tool.
Finally, I will show a quick how-to to get you started using it.


2. My Setup

For running the Cheat.sh tool, I used Kali Linux in a VMware Workstation 16 Player virtualized environment.


3. What is Cheat.sh?

Cheat.sh is a command line tool that offers Linux command cheat sheets from the cheat.sh website.

You can use the cheat.sh tool directly in the command line or you can browse to the cheat.sh to see the same output.

What makes cheat.sh awesome? While cheat.sh does not make up for the manual pages in Linux, it offers a concise and common usage of commands displayed nicely right in your terminal output.

Find more information about Cheat.sh here.

Cheat.sh GitHub here.


4. Why use Cheat.sh?

You can find common Linux commands and their typical use using cheat.sh command.


5. How to use Cheat.sh?

Step 1: 
You can simply navigate to the cheat.sh website which is "cheat.sh" and use 
the tool in a web browser. However, if you want to install cheat.sh to the 
command line continue to step 2.


Step 2:

To install cheat.sh to the terminal I am going to use the cheat.sh GitHub and instructions located: here.

Step 3:
I am going to install cheat.sh globally so I will use the provided command 
from the installation portion of the GitHub:

curl -s https://cht.sh/:cht.sh | sudo tee /usr/local/bin/cht.sh && sudo chmod +x /usr/local/bin/cht.sh


If all went well with the curl transfer and permission change then you should be able to use cht.sh commands immediately.

Note cheat.sh is the website. cht.sh is the command in your terminal.

Step 4:
Let's try out the cht.sh command, type the following in your terminal window:
cht.sh chown

You should see a display showing the chown command its common uses.


Congratulations on installing cheat.sh as a command cht.sh directly to your terminal! While this may not replace your manual pages, it certainly gives a quick and concise reference page for commands.

Step 5 (bonus):
Let's give cht.sh an alias so we do not have to type cht.sh <command> every time.

Enter this command in your terminal to determine which shell you are using:

echo "$SHELL"

Note the output, mine says "usr/bin/zsh"


Step 6 (bonus):
In your home directory type the following command:

ls -la

This should list out all files and hidden files. 

I am looking for the file .zshrc while you may be looking for the file .bashrc


Step 7 (bonus):
The .zshrc or .bashrc file contains variables, aliases, functions and other 
settings that are used in every terminal you open. 

I want to make the command cht.sh become cht so I do not have to type the .
sh every time. 

So I run the command:

sudo nano .zshrc

Scroll down to the alias section (hint: you can use page up / down) 
and add the alias:

alias cht='cht.sh' 

to save and exit:

Ctrl + X | y | <enter>


Step 8 (bonus):
Open a new terminal window.


Step 9 (bonus):
Test your alias:

cht ls


If you see the response from cht.sh then your alias works!

6. Summary

This blog post showed you a very brief overview of what Cheat.sh is, and some of its capabilities.

Cheat.sh and its terminal tool cht.sh is a simple cheat sheet reference tool for commands.

This tool does not replace the official manual pages but does offer a quicker and easier reference for common command use.

Thanks for reading!

If you have suggestions for what tool to cover next, contact me!