Linux Command Line - Cheat

by rosborn1 in Circuits > Linux

58 Views, 0 Favorites, 0 Comments

Linux Command Line - Cheat

Screen Shot 2026-03-02 at 10.38.57 AM.png


While working in the linux command line I often forget some commands. There is the man command which is quite the manual for all things linux. There is the info command which is quite informative. I want to show you the cheat command which is a bit like cheating. Some of the linux commands can be quite esoteric when you include flags, pipes, and redirects etc. If there is one of these commands you use somewhat infrequently and can't quite remember every time you try to use it you can save it as a cheat file that can be easily viewed. There is a community of users that have built cheats for many different uses ready for you. There is an app that can be installed and a web site where you can view cheats as well. We will be using the debian13 distribution, using apt and snap package managers, and everything can be done from the command line.

Yes, you should really know the linux command line. It is the language of high tech makers, flashing lights and such. For this tutorial you will need to know just a bit more than the basic knowledge of the linux command line. There is a plethora of tutorials on linux.

This tutorial is actually for those that are quite conversant in the linux command line but have just a little trouble remembering some of the finer details of commands they don't use every day but often enough to write down in a place they always forget then have to figure out all over again, all over again.

Packages

You can run cheat to lookup what you are looking for, you can run curl to to view web pages on the command line, you can run snap to install the cheat package. That is you could run cheat or curl or snap from the command line except for the fact they won't be installed on the debian operating system yet. We will use the package manager apt to install curl and snap, then use snap to install cheat.

Package managers are a part of life in the linux command line. An application requires more than one file. There are supporting files that have to be there for everything to work. This comes all together in a package. There are several package managers. In debian the package manager you will be using is called apt. The apt package manager must be run using sudo - super user do. Just plain old user do won't do.Snap is also a package manager.

Why, you say, do we need more than one package manager. Linux is basically a kernel that everything else is built around. There are an abundance of linux distributions, debian, ubuntu, red hat, suse, etc. that all do things a little bit differently because everybody does things a little bit differently. everybody wants to do different things, like bicycling and rollerskating but we all get there. If you study hard you too can write your own linux distribution and package manager.

You will need to be in the sudoers list to use package managers.

to get on the sudoers list you must have root access by entering su, add your username to the sudo group, then verify your name has been added to the sudo group. Enter passwords when needed.

su
sudo adduser -aG sudoers your_username
sudo groups your_username.
sudo reboot now

The commands to install packages, enter passwords where needed: :

sudo apt install curl.
sudo apt install snapd,
sudo snap install cheat.
sudo reboot now

You are ready to use cheat. Download the community cheatsheets. try cheat ls

cheat ls
A config file was not found. Would you like to create one now? [Y/n]: y
Would you like to download the community cheatsheets? [Y/n]: y

there are 282 community cheatsheets as of today.

Cheat the Web Site

Screen Shot 2026-03-04 at 6.54.45 AM.png

You can see that at the moment i am writing this the cheat.sh website is down. You can also see I don't have the expertise to resize an image in instructables. Interestingly enough going to the command line and entering curl cheat.sh achieves the desired results. I have found this to be true on a few occasions when i have seen a website nonfunctional. Another good reason to learn the command line. I am sure their website will be working soon. I am sure i will learn fine details of editing instructables.

We could just look up a command and it's options at cheat.sh/whatever_command_you_want when the website is working . Open your web browser. One of the first commands you learn in linux is the ls command. Enter cheat.sh/ls in the browser. You will get a list of possible uses of the ls command. Pick any command and try it out.

But we scoff at your web browser because we have the command line. It is also possible to access the web page via the command line using the curl command. curl cheat.sh/ls . You will see relatively the same thing displayed in the command line... while scoffing.

curl - client uniform resource locator, or web address client for the command line. Back in the old days not everybody could have a web browser and there are certain features of the command line that make curl useful.

Cheat the App

Now that the app has been installed try cheat -v .

cheat -v
4.4.0

You should see a version number. cheat -h gives you help. cheat -l lists all of the files and their locations. It is important to know file locations and ownership and privelidges. here are locations you should know.

ls la ~/snap/cheat/common/.config/cheat/cheatsheets/community/
ls -la ~/snap/cheat/common/.config/cheat/cheatsheets/personal/
ls -la ~/snap/cheat/common/.config/cheat/conf.yml

Very good. If at this point you don't see the desired result troubleshooting will be required, the fun part. I often use AI support to troubleshoot. I don't usually trust AI, it halucinates and just outright lies on occasion but usually for technical matters it is pretty good.

What if you are looking for a command and it does not appear in the app?

cheat foo
No cheatsheet found for 'foo'.

Check the website.

curl cheat.sh/foo
# bar
# The terms foobar (/ˈfuːbɑːr/), or foo and others are used as metasyntactic
...

We can see the cheat sheet on the website but we want it on our computer in case the internet goes down. Use the curl command to get cheat.sh/foo and redirect it to your personal cheat sheet directory. And it is there.

curl -s cheat.sh/foo?T > snap/cheat/common/.config/cheat/cheatsheets/personal/foo
cheat foo.
# bar
# The terms foobar (/ˈfuːbɑːr/), or foo and others are used as metasyntactic
...

The cheat sheets can be edited. For this you will need skill with the vi editor. If you don't know the vi editor it has quite the learning curve, quite a bit of learning, big curve, probably more than you would care to learn.

cheat -e foo

If you like the nano editor better we can change a config file.

nano snap/cheat/common/.config/cheat/conf.yml

change a line in the file-

from:

editor: /usr/bin/editor

to

editor: nano

save and exit.

Now cheat -e foo brings up the nano editor.

I have been working with virtual machines. I have also been having a hard time keeping track of where I am and what I am doing. i am going to create a procedure to install a virtual machine manager. I just create a file and edit my procedure into it move it to the proper directory and i can bring it up with cheat any time. let us test.

echo kvm test > snap/cheat/common/.config/cheat/cheatsheets/personal/kvm
cheat kvm
kvm test

I have just created a file snap/cheat/common/.config/cheat/cheatsheets/personal/kvm and added a little "test kvm" text to make sure it works. and it does. I am going to put my whole procedure in the file.

cheat -e kvm
#kvm install
#verify virtualization ability
egrep -c '(vmc|svm)' /proc/cpuinfo
...

save and exit

cheat kvm
#kvm install
#verify virtualization ability
egrep -c '(vmc|svm)' /proc/cpuinfo
...

my installation procedure is now at my fingertips anytime whether I am online or not. The pound sign, #, is for comments. The lines with no pound signs are the actual commands. The first command:

egrep -c '(vmc|svm)' /proc/cpuinfo

might not be easy to remember exactly. There are several lengthy commands in the procedure. they are all here with comments describing what each command does. Now my brain has room for other things.

So, not too much effort to install some apps, some small effort to document a major procedure, very minimal effort to recall the procedure at any time. The files can be moved from one machine to another as well. You can build your own cheat sheets and have a fun day.


.

Reference

This is just another tool in your box, but I think it is rather handy. And who wouldn't want to use a command called cheat.

It is important to note the date and version numbers because things change. Change is inevitable. In the last century installing linux would be much more difficult and require more expertise than today. So, some but not all change is good. We could ask the dinosaurs about change but... change happens.

some references:

debian 13

cheat v 4.4.0

https://itslinuxfoss.com/add-user-sudoers-debian-12/

https://curl.se/

https://cheat.sh/

https://snapcraft.io/

https://en.wikipedia.org/wiki/List_of_Linux_package_management_systems

https://github.com/chubin/cheat.sh

https://www.debian.org/doc/manuals/apt-guide/index.en.html


My virtual machine manager installation procedure:

cheat kvm
#kvm install
#using apt package manager
#good for ubuntu/debian
#current user is in sudoers

#verify virtualization ability, should be greater than 0
egrep -c '(vmc|svm)' /proc/cpuinfo
#for mac mini
egrep -c '(vmx|svm)' /proc/cpuinfo

sudo apt update
sudo apt upgrade

#install kvm and support
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y

#add current user to groups
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER

# reboot required here
sudo reboot now

#verify user is member of groups
getent group kvm
getent group libvirt

#check status of libvirt demon
#check for enabled active
sudo systemctl status libvirtd

#set net-autostart for default network
sudo virsh net-autostart default

#if not enabled and active
sudo systemctl start libvirtd
sudo systemctl enable libvirtd

#start graphical interface virt manager
virt-manager

#location of libvirt images
sudo ls /var/lib/libvirt/images

#check ownership of qemu
#drwxr-x--- 8 libvirt-qemu libvirt-qemu 4096 Feb 26 07:32 qemu
ls -la /var/lib/libvirt

#command line virsh commands
curl -s https://cheat.sh/virsh?T > /home/ar/snap/cheat/common/.config/cheat/cheatsheets/personal/virsh
cheat virsh
#add more commands as found


And thank you igor_chubin .

2026-03-04