├── .github ├── LICENSE.txt └── README.md ├── 7z ├── ab ├── acl ├── ag ├── alias ├── ansi ├── ansible ├── ansible-galaxy ├── ansible-vault ├── apachectl ├── apk ├── apparmor ├── apt ├── apt-cache ├── apt-get ├── aptitude ├── aria2c ├── asciiart ├── asciidoctor ├── asterisk ├── at ├── auditd ├── awk ├── bash ├── bat ├── black ├── bosh ├── bower ├── brew ├── bzip2 ├── cat ├── cd ├── cheat ├── chmod ├── chown ├── cmp ├── comm ├── conda ├── convert ├── cp ├── cpan ├── cpanm ├── cpdf ├── cpio ├── crontab ├── cryptsetup ├── csplit ├── cups ├── curl ├── cut ├── date ├── dd ├── deb ├── df ├── dhclient ├── diff ├── distcc ├── distrobox ├── dnf ├── docker ├── docker-compose ├── dpkg ├── du ├── dwm ├── ed ├── emacs ├── env ├── ethtool ├── exiftool ├── export ├── fd ├── ffmpeg ├── find ├── firewall-cmd ├── fkill ├── fmt ├── for ├── fzf ├── gcc ├── gdb ├── gem ├── gh ├── git ├── go ├── gpg ├── gradle ├── grep ├── gs ├── guix-shell ├── gyb ├── gzip ├── hardware-info ├── head ├── hg ├── history ├── http ├── hub ├── iconv ├── ifconfig ├── indent ├── install ├── ip ├── iptables ├── irssi ├── iwconfig ├── jar ├── java ├── javac ├── jbang ├── jobs ├── journalctl ├── jq ├── jrnl ├── kill ├── kitty ├── kubectl ├── less ├── lib ├── ln ├── ls ├── lsblk ├── lsof ├── lvm ├── man ├── markdown ├── maven ├── mdadm ├── minikube ├── mkdir ├── more ├── mount ├── multipass ├── mutt ├── mv ├── mysql ├── mysqldump ├── nc ├── ncat ├── ncdu ├── netstat ├── nft ├── nkf ├── nmap ├── nmcli ├── notify-send ├── nova ├── npm ├── ntp ├── numfmt ├── od ├── openssl ├── org-mode ├── p4 ├── pacman ├── pactl ├── pandoc ├── pass ├── paste ├── patch ├── pdftk ├── perl ├── perlbrew ├── perldoc ├── pgrep ├── php ├── ping ├── ping6 ├── pip ├── pkcon ├── pkgtools ├── pkill ├── plenv ├── podman ├── poetry ├── popd ├── port ├── ps ├── psql ├── pushd ├── pwd ├── pyenv ├── python ├── quickemu ├── quickget ├── r2 ├── rcs ├── readline ├── reboot ├── rename ├── rm ├── rmdir ├── route ├── rpm ├── rpm2cpio ├── rss2email ├── rsync ├── ruby ├── salt ├── sam2p ├── sar ├── scd ├── scp ├── screen ├── sed ├── selinux ├── sha256sum ├── shred ├── shutdown ├── slurm ├── smbclient ├── snap ├── snmpwalk ├── socat ├── sockstat ├── sort ├── split ├── sport ├── sqlite3 ├── sqlmap ├── ss ├── ssh ├── ssh-add ├── ssh-copy-id ├── ssh-keygen ├── stdout ├── strace ├── su ├── sudo ├── svn ├── systemctl ├── systemd ├── tail ├── tar ├── tarsnap ├── tcpdump ├── tee ├── terraform ├── tidy ├── timedatectl ├── tmux ├── top ├── touch ├── tr ├── trashy ├── tree ├── truncate ├── udisksctl ├── ulimit ├── uname ├── uniq ├── unzip ├── uptime ├── urpm ├── usermod ├── vagrant ├── vim ├── vim-plugins ├── vim-fzf ├── vim-goyo ├── vim-limelight └── vim-markdown ├── virtualenv ├── wc ├── weechat ├── wget ├── wmctrl ├── woeusb ├── xargs ├── xdotool ├── xmlto ├── xrandr ├── xxd ├── yaourt ├── youtube-dl ├── yum ├── z ├── zfs ├── zip ├── zoneadm └── zsh /.github/README.md: -------------------------------------------------------------------------------- 1 | cheatsheets 2 | =========== 3 | This repository contains community-sourced cheatsheets to be used with 4 | [cheat][] and similar applications. 5 | 6 | ### Format ### 7 | Cheatsheets are plain-text files that begin with an optional "front matter" 8 | header in YAML format. The header may be used to assign "tags" to a sheet, and 9 | to specify the sheet's syntax (`bash`, `python`, `go`, etc). 10 | 11 | When possible, cheatsheets should conform to this format: 12 | 13 | ```sh 14 | --- 15 | syntax: bash 16 | tags: [ vcs, development ] 17 | --- 18 | # To stage all changes in the current directory: 19 | git add --all 20 | 21 | # To commit staged changes: 22 | git commit -m 23 | ``` 24 | 25 | As a guideline, it is preferred to use [docopt][] syntax when specifying 26 | parameter placeholders. In edge-cases where that syntax may cause confusion, it 27 | is permissible to use placeholder values (`foo.txt`, `example.com`, etc.) as 28 | necessary. 29 | 30 | ### License ### 31 | Cheatsheets are licensed under [Creative Commons CC0 1.0][cc0]. See 32 | [LICENSE.txt][] for the full license text. 33 | 34 | 35 | [LICENSE.txt]: https://github.com/cheat/cheatsheets/blob/master/.github/LICENSE.txt 36 | [cc0]: https://creativecommons.org/publicdomain/zero/1.0/legalcode 37 | [cheat]: https://github.com/cheat/cheat 38 | [docopt]: http://docopt.org 39 | -------------------------------------------------------------------------------- /7z: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ compression ] 3 | --- 4 | 7z [Args] [archive.7z] [files / folders to archive] 5 | A file archiver with highest compression ratio 6 | 7 | Args: 8 | a add 9 | d delete 10 | e extract 11 | l list 12 | t test 13 | u update 14 | x extract with full paths 15 | 16 | DO NOT USE the 7-zip format for backup purpose on Linux/Unix. 17 | 7-zip does not store the owner/group of the file. 18 | 19 | On Linux/Unix, in order to backup directories you must use tar : 20 | - to backup a directory : tar cf - directory | 7z a -si directory.tar.7z 21 | - to restore your backup : 7z x -so directory.tar.7z | tar xf - 22 | 23 | If you want to send files and directories (not the owner of file) to others 24 | Unix/MacOS/Windows users, you can use the 7-zip format. 25 | 26 | Example 1: Quick and Easy - Add all files in dir1 to archive.7z with Default Settings. 27 | 7z a archive.7z dir1 28 | 29 | Example 2: Add all files in dir1 to archive.7z with Max Compression 30 | 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1 31 | 32 | -t7z 7z archive 33 | -m0=lzma lzma method 34 | -mx=9 level of compression = 9 (ultra) 35 | -mfb=64 number of fast bytes for lzma = 64 36 | -md=32m dictionary size = 32 Mb 37 | -ms=on solid archive = on 38 | 39 | Example 3: Add (store) all files in dir1 to archive.7z with No Compression 40 | 7z a -m0=copy archive.7z dir1 41 | 42 | 7z exit codes: 43 | 44 | 0 normal (no errors or warnings) 45 | 1 warning (non-fatal errors) 46 | 2 fatal error 47 | 7 bad cli arguments 48 | 8 not enough memory for operation 49 | 255 process was interrupted 50 | -------------------------------------------------------------------------------- /ab: -------------------------------------------------------------------------------- 1 | # To send 100 requests with a concurency of 50 requests to a URL: 2 | ab -n 100 -c 50 3 | 4 | # To send requests for 30 seconds with a concurency of 50 requests to a URL: 5 | ab -t 30 -c 50 6 | -------------------------------------------------------------------------------- /acl: -------------------------------------------------------------------------------- 1 | # Get ACL 2 | getfacl 3 | 4 | # Add or modify ACL on file 5 | setfacl -m u:username:rX 6 | setfacl -m g:groupname:rw 7 | setfacl -m o::- 8 | 9 | # or provide all permissions at once 10 | setfacl -m u::rwx,g:groupname:rX,o::- 11 | 12 | # Copy ACL from file-A to file-B 13 | getfacl file-A | setfacl -M - file-B 14 | 15 | # Apply ACL recursivelly to directory 16 | setfacl -R -m u:username:rX 17 | 18 | # Delete ACL 19 | setfacl -x u:username,g:groupname 20 | 21 | # Delete all ACL on file, including default 22 | setfacl -b 23 | 24 | # Same operations works for default ACLs 25 | setfacl -m d:u:username:rx 26 | setfacl -x d:u:username 27 | 28 | # Delete only default ACLs 29 | setfacl -k 30 | -------------------------------------------------------------------------------- /ag: -------------------------------------------------------------------------------- 1 | # To exclude a directory from a search: 2 | ag --ignore-dir= 3 | 4 | # To exclude a file from a search: 5 | ag --ignore= 6 | 7 | # To force colorization: 8 | ag --color | less -R 9 | 10 | # To search for in files whose names match : 11 | ag -G 12 | -------------------------------------------------------------------------------- /alias: -------------------------------------------------------------------------------- 1 | # To show a list of your current shell aliases: 2 | alias 3 | 4 | # To alias `ls -l` to `ll`: 5 | alias ll='ls -l' 6 | 7 | # To remove alias: 8 | unalias ll 9 | -------------------------------------------------------------------------------- /ansi: -------------------------------------------------------------------------------- 1 | # Reset 2 | Color_Off='\e[0m' # Text Reset 3 | 4 | # Regular Colors 5 | Black='\e[0;30m' # Black 6 | Red='\e[0;31m' # Red 7 | Green='\e[0;32m' # Green 8 | Yellow='\e[0;33m' # Yellow 9 | Blue='\e[0;34m' # Blue 10 | Purple='\e[0;35m' # Purple 11 | Cyan='\e[0;36m' # Cyan 12 | White='\e[0;37m' # White 13 | 14 | # Bold 15 | BBlack='\e[1;30m' # Black 16 | BRed='\e[1;31m' # Red 17 | BGreen='\e[1;32m' # Green 18 | BYellow='\e[1;33m' # Yellow 19 | BBlue='\e[1;34m' # Blue 20 | BPurple='\e[1;35m' # Purple 21 | BCyan='\e[1;36m' # Cyan 22 | BWhite='\e[1;37m' # White 23 | 24 | # Underline 25 | UBlack='\e[4;30m' # Black 26 | URed='\e[4;31m' # Red 27 | UGreen='\e[4;32m' # Green 28 | UYellow='\e[4;33m' # Yellow 29 | UBlue='\e[4;34m' # Blue 30 | UPurple='\e[4;35m' # Purple 31 | UCyan='\e[4;36m' # Cyan 32 | UWhite='\e[4;37m' # White 33 | 34 | # Background 35 | On_Black='\e[40m' # Black 36 | On_Red='\e[41m' # Red 37 | On_Green='\e[42m' # Green 38 | On_Yellow='\e[43m' # Yellow 39 | On_Blue='\e[44m' # Blue 40 | On_Purple='\e[45m' # Purple 41 | On_Cyan='\e[46m' # Cyan 42 | On_White='\e[47m' # White 43 | 44 | # High Intensity 45 | IBlack='\e[0;90m' # Black 46 | IRed='\e[0;91m' # Red 47 | IGreen='\e[0;92m' # Green 48 | IYellow='\e[0;93m' # Yellow 49 | IBlue='\e[0;94m' # Blue 50 | IPurple='\e[0;95m' # Purple 51 | ICyan='\e[0;96m' # Cyan 52 | IWhite='\e[0;97m' # White 53 | 54 | # Bold High Intensity 55 | BIBlack='\e[1;90m' # Black 56 | BIRed='\e[1;91m' # Red 57 | BIGreen='\e[1;92m' # Green 58 | BIYellow='\e[1;93m' # Yellow 59 | BIBlue='\e[1;94m' # Blue 60 | BIPurple='\e[1;95m' # Purple 61 | BICyan='\e[1;96m' # Cyan 62 | BIWhite='\e[1;97m' # White 63 | 64 | # High Intensity backgrounds 65 | On_IBlack='\e[0;100m' # Black 66 | On_IRed='\e[0;101m' # Red 67 | On_IGreen='\e[0;102m' # Green 68 | On_IYellow='\e[0;103m' # Yellow 69 | On_IBlue='\e[0;104m' # Blue 70 | On_IPurple='\e[0;105m' # Purple 71 | On_ICyan='\e[0;106m' # Cyan 72 | On_IWhite='\e[0;107m' # White 73 | -------------------------------------------------------------------------------- /ansible: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ orchestration ] 3 | --- 4 | # To run a command on multiple instances at once - using `servers` group from `inventory.yml`: 5 | ansible -u ansible -i inventory.yml servers -m shell -a "ls /var" 6 | -------------------------------------------------------------------------------- /ansible-galaxy: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ orchestration ] 3 | --- 4 | # To install a role: 5 | ansible-galaxy install . 6 | 7 | # To remove a role: 8 | ansible-galaxy remove . 9 | 10 | # To list installed roles: 11 | ansible-galaxy list 12 | 13 | # To search for a given role: 14 | ansible-galaxy search 15 | 16 | # To create a new role: 17 | ansible-galaxy init 18 | 19 | # To get the information for the role # or a collection if you replace `role` with `collection`: 20 | ansible-galaxy role info . 21 | -------------------------------------------------------------------------------- /ansible-vault: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ orchestration ] 3 | --- 4 | # To enncrypt string using keyfile `backup_encryption_key`: 5 | ansible-vault encrypt_string 'SupersecretPa$$phrase' --name 'backup_encryption_key' 6 | -------------------------------------------------------------------------------- /apachectl: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ apache, httpd ] 3 | --- 4 | # To test Apache configuration file syntax 5 | apachectl configtest 6 | -------------------------------------------------------------------------------- /apk: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ packaging ] 3 | --- 4 | # To install a package: 5 | apk add 6 | 7 | # To remove a package: 8 | apk del 9 | 10 | # To update repos: 11 | apk update 12 | 13 | # To upgrade all packages: 14 | apk upgrade 15 | 16 | # To find a package: 17 | apk search 18 | -------------------------------------------------------------------------------- /apparmor: -------------------------------------------------------------------------------- 1 | # apparmor will protect a system by confining programs to a limited set of resources. 2 | 3 | # To activate a profile: 4 | sudo aa-enforce usr.bin.firefox 5 | # or 6 | export _PROFILE_='usr.bin.firefox' sudo $(rm /etc/apparmor.d/disable/$_PROFILE_ ; cat /etc/apparmor.d/$_PROFILE_ | apparmor_parser -a ) 7 | 8 | # To disable a profile: 9 | sudo aa-disable usr.bin.firefox 10 | # or 11 | export _PROFILE_='usr.bin.firefox' sudo $(ln -s /etc/apparmor.d/$_PROFILE_ /etc/apparmor.d/disable/ && apparmor_parser -R /etc/apparmor.d/$_PROFILE_) 12 | 13 | # To list profiles loaded: 14 | sudo aa-status 15 | # or 16 | sudo apparmor_status 17 | 18 | # List of available profiles: /etc/apparmor.d/ 19 | -------------------------------------------------------------------------------- /apt: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ packaging ] 3 | --- 4 | # To find packages matching : 5 | apt search 6 | 7 | # To show information on a package: 8 | apt show 9 | 10 | # To fetch package list: 11 | apt update 12 | 13 | # To download and install the updates and (UNLIKE apt-get) install new necessary packages: 14 | apt upgrade 15 | 16 | # To download and install the updates AND install new necessary packages 17 | # AND remove packages that stand in the way of the upgrade - use with caution: 18 | apt dist-upgrade 19 | 20 | # To perform a full system upgrade: 21 | apt update && apt upgrade # use dist-upgrade carefully if needed 22 | 23 | # To install package(s): 24 | apt install ... 25 | 26 | # To uninstall package(s): 27 | apt remove ... 28 | 29 | # To remove automatically all unused packages: 30 | apt autoremove 31 | 32 | # To list dependencies of a package: 33 | apt depends ... 34 | 35 | # To remove packages and delete their config files: 36 | apt purge ... 37 | 38 | # To list all packages installed: 39 | apt list --installed 40 | -------------------------------------------------------------------------------- /apt-cache: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ packaging ] 3 | --- 4 | # To find packages matching : 5 | apt-cache search 6 | 7 | # To display package records for the named package(s): 8 | apt-cache show ... 9 | 10 | # To display reverse dependencies of a package: 11 | apt-cache rdepends 12 | 13 | # To display package versions, reverse dependencies and forward dependencies of 14 | # a package: 15 | apt-cache showpkg 16 | 17 | # To display package installation status and what version is available from 18 | # its repository: 19 | apt-cache policy 20 | -------------------------------------------------------------------------------- /apt-get: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ packaging ] 3 | --- 4 | # To fetch package list: 5 | apt-get update 6 | 7 | # To download and install package updates: 8 | apt-get upgrade 9 | 10 | # To download and install the updates AND install new necessary packages 11 | # AND remove any packages that stand in the way of the upgrade: 12 | apt-get dist-upgrade 13 | 14 | # Full command: 15 | apt-get update && apt-get dist-upgrade 16 | 17 | # To install a new package(s): 18 | apt-get install ... 19 | 20 | # To download a package without installing it. (The package will be downloaded in your current working dir) 21 | apt-get download 22 | 23 | # To change cache dir and archive dir (where .deb are stored): 24 | apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ... 25 | 26 | # To show apt-get installed packages: 27 | grep 'install ' /var/log/dpkg.log 28 | 29 | # To silently keep old configuration during batch updates: 30 | apt-get update -o DPkg::Options::='--force-confold' ... 31 | -------------------------------------------------------------------------------- /aptitude: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [ packaging ] 3 | --- 4 | # To find packages matching : 5 | aptitude search 6 | 7 | # To display package records for the named package(s): 8 | aptitude show ... 9 | 10 | # To install package(s): 11 | aptitude install ... 12 | 13 | # To remove package(s): 14 | aptitude remove ... 15 | 16 | # To remove unnecessary package: 17 | aptitude autoclean 18 | -------------------------------------------------------------------------------- /aria2c: -------------------------------------------------------------------------------- 1 | # To download a file: 2 | # The url can be a http(s), ftp, .torrent file or even a magnet link 3 | aria2c 4 | 5 | # To prevent downloading the .torrent file: 6 | aria2c --follow-torrent=mem 7 | 8 | # Download 1 file at a time (-j) 9 | # continuing (-c) any partially downloaded ones 10 | # to the directory specified (-d) 11 | # reading urls from the file (-i): 12 | aria2c -j 1 -c -d ~/Downloads -i 13 | -------------------------------------------------------------------------------- /asciiart: -------------------------------------------------------------------------------- 1 | # To show some text in ASCII Art: 2 | 3 | figlet Cheat 4 | # ____ _ _ 5 | # / ___| |__ ___ __ _| |_ 6 | #| | | '_ \ / _ \/ _` | __| 7 | #| |___| | | | __/ (_| | |_ 8 | # \____|_| |_|\___|\__,_|\__| 9 | # 10 | 11 | 12 | # To have some text with color and other options: 13 | # Show with a border 14 | toilet -F border Cheat 15 | # Basic show (filled) 16 | toilet Cheat 17 | # mmm # m 18 | # m" " # mm mmm mmm mm#mm 19 | # # #" # #" # " # # 20 | # # # # #"""" m"""# # 21 | # "mmm" # # "#mm" "mm"# "mm 22 | # 23 | -------------------------------------------------------------------------------- /asciidoctor: -------------------------------------------------------------------------------- 1 | # headers 2 | = h1 header 3 | == h2 header 4 | 5 | 6 | # blocks 7 | [quote, Somebody, Who is somebody] 8 | ____ 9 | Quote something 10 | ____ 11 | // 12 | NOTE: Some note 13 | // 14 | [WARNING] 15 | ==== 16 | Some warning 17 | ==== 18 | 19 | # lists 20 | .Un-ordered list with a title 21 | * list item 22 | ** sub-list item 23 | - hypen as sub-sub-list item 24 | + 25 | that continues at the next line 26 | - {blank} 27 | + 28 | ---- 29 | complex content of an item 30 | ---- 31 | 32 | [%reversed,start=4] 33 | .Ordered list; reversed, started at 4 34 | . ordered list item 35 | .. ordered list sub-item 36 | . another list item 37 | 38 | # separating adjacent lists (surrounded by blank lines) 39 | //- 40 | 41 | # checklist 42 | - [*] checked 43 | - [x] also checked 44 | - [ ] not checked 45 | 46 | Description list item:: definition 47 | [horizontal] 48 | Description list item #2:: definition 49 | 50 | 51 | # links 52 | Automatic link http://example.com or 53 | http://example.com[link with title and attributes,role=external,window=_blank] 54 | link:../README.adoc[Relative link to open the README file] 55 | 56 | 57 | # cross reference links 58 | [[an-anchor]]inline anchor, [#other-anchor]#applied to a phrase# 59 | Reference to <> or to <> 60 | 61 | 62 | # image 63 | image:image.png[Alt text, title="Inline image"] 64 | 65 | .Block image title 66 | [caption="Figure 1: ",link=http://example.com/image.png] 67 | image::image.jpg[Alt text, 300, 200] 68 | 69 | 70 | # code 71 | .... 72 | literal block 73 | .... 74 | 75 | :variable: 123 76 | .Source code title 77 | [source,asciidoc,subs="+quotes,attributes+",options="nowrap"] 78 | ---- 79 | :toc: right # <1> 80 | // with var substitution (attributes+) 81 | :variable: definition, the value is {variable} 82 | // with the markup substitution (+quotes) 83 | // no wrapping long lines (nowrap) 84 | ---- 85 | <1> Asciidoctor sytax for the table of content 86 | 87 | # include source code, stripping indentation 88 | [source,asciidoc,indent=0] 89 | ---- 90 | include::doc/document.adoc[lines=5..10] 91 | ---- 92 | 93 | # formatting 94 | *bold*, **un**constrained 95 | _italic_, __un__constrained 96 | `monospace`, ``un``constrained 97 | `[underline]#Underline text#` 98 | `[overline]#overline text#` 99 | `[line-through]#strikethrough#` 100 | `[blue line-through]*bold blue and line-through*.` 101 | 102 | # comment 103 | // text in the comment 104 | 105 | # horizontal rules (hr) 106 | ''' 107 | 108 | Non-breaking space {nbsp} 109 | Break at the end of + 110 | line 111 | 112 | # tables 113 | .Table title 114 | [caption="Table 2: "] 115 | |=== 116 | | Name | Description 117 | // 118 | | Asciidoctor 119 | | Awesome way to write documentation 120 | // 121 | 2+| This cell spans 2 columns 122 | // 123 | .2+| This cell spans 2 rows 124 | // 125 | | Line at the side of the spanned rows 126 | | Another line 127 | // 128 | |=== 129 | -------------------------------------------------------------------------------- /asterisk: -------------------------------------------------------------------------------- 1 | # To connect to a running Asterisk session: 2 | asterisk -rvvv 3 | 4 | # To issue a command to Asterisk from the shell: 5 | asterisk -rx "" 6 | 7 | # To originate an echo call from a SIP trunk on an Asterisk server, to a specified number: 8 | asterisk -rx "channel originate SIP// application echo" 9 | 10 | # To print out the details of SIP accounts: 11 | asterisk -rx "sip show peers" 12 | 13 | # To print out the passwords of SIP accounts: 14 | asterisk -rx "sip show users" 15 | 16 | # To print out the current active channels: 17 | asterisk -rx "core show channels" 18 | -------------------------------------------------------------------------------- /at: -------------------------------------------------------------------------------- 1 | # To schedule a one time task: 2 | at