October 6, 2024

Where Fedora Matter

Where Fedora Matter

Using the cheat command on Fedora Linux – Network World

$ cheat uname
# To print all system information:
uname -a
# Linux system-hostname 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 GNU/Linux

# To print the hostname:
uname -n
# system-hostname

# To print the kernel release:
uname -r
# 3.2.0-4-amd64

# To print the kernel version, with more specific information:
uname -v
# #1 SMP Debian 3.2.32-1

# To print the hardware instruction set:
uname -m
# x86_64

# To print the kernel name:
uname -s
# Linux

# To print the operating system:
uname -o
# GNU/Linux

The command cheat sheets that are installed with the cheat tool include all of these:

$ cd /usr/share/cheat
$ ls
7z          csplit         head        mutt         pip        snmpwalk     tree
ab          cups           hello       mv           pkcon      socat        truncate
acl         curl           hg          mysql        pkgtools   sockstat     udisksctl
alias       cut            history     mysqldump    pkill      sort         ulimit
ansi        date           http        nc           popd       split        uname
apk         dd             hub         ncat         ps         sport        uniq
apparmor    deb            iconv       ncdu         psql       sqlite3      unzip
apt         df             ifconfig    netstat      pushd      sqlmap       urpm
apt-cache   dhclient       indent      nkf          pwd        ss           vagrant
apt-get     diff           ip          nmap         python     ssh          vim
aptitude    distcc         iptables    nmcli        r2         ssh-add      virtualenv
aria2c      dnf            irssi       notify-send  rcs        ssh-copy-id  wc
asciiart    docker         iwconfig    nova         readline   ssh-keygen   weechat
asterisk    dpkg           journalctl  npm          rename     stdout       wget
at          du             jq          ntp          rm         strace       xargs
awk         emacs          jrnl        numfmt       route      su           xmlto
bash        export         kill        od           rpm        sudo         xrandr
bower       ffmpeg         less        openssl      rpm2cpio   svn          xxd
bzip2       find           lib         org-mode     rss2email  systemctl    yaourt
cat         fkill          ln          p4           rsync      systemd      youtube-dl
cd          for            ls          pacman       sam2p      tail         yum
cheat       gcc            lsblk       pass         scd        tar          z
chmod       gdb            lsof        paste        scp        tarsnap      zfs
chown       git            lvm         patch        screen     tcpdump      zip
comm        gpg            man         pdftk        sed        tee          zoneadm
convert     grep           markdown    perl         shred      tidy         zsh
cp          gs             mdadm       pgrep        shutdown   tmux
cpdf        gyb            mkdir       php          slurm      top
crontab     gzip           more        ping         smbclient  tr
cryptsetup  hardware-info  mount       ping6        snap       trashy

You can display a cheat sheet for any of these commands. Some will show a long series of examples and others, just a few. This, of course, depends on the command’s complexity and options.

$ cheat ulimit
# Report all current limits
ulimit -a

# Unlimited file descriptors
ulimit -n unlimited

There is no man page available for the cheat command, but you can cheat on the cheat command itself to see its options:

$ cheat cheat
# To see example usage of a program:
cheat 

# To edit a cheatsheet
cheat -e 

# To list available cheatsheets
cheat -l

# To search available cheatsheets
cheat -s 

# To get the current `cheat' version
cheat -v

Using the cheat -l command, for example, we can see the commands, files and tags which tell where the cheat sheets came from:

$ cheat -l | head -11
title:        file:                          tags:
7z            /usr/share/cheat/7z            community,compression
ab            /usr/share/cheat/ab            community
acl           /usr/share/cheat/acl           community
alias         /usr/share/cheat/alias         community
ansi          /usr/share/cheat/ansi          community
apk           /usr/share/cheat/apk           community,packaging
apparmor      /usr/share/cheat/apparmor      community
apt           /usr/share/cheat/apt           community,packaging
apt-cache     /usr/share/cheat/apt-cache     community,packaging
apt-get       /usr/share/cheat/apt-get       community,packaging

If you want to add your own cheat sheets, you first need to select your editor and create a directory to store them.

$ export CHEAT_EDITOR=/usr/bin/vim
$ mkdir .cheat

Then use the cheat -e command to create your cheat sheet:

Share: Facebook Twitter Linkedin
Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *