All in One Cheat Sheet

156 Quick References for Devops, Developers, Sys admins and Networkers

Get Printables

ab

ab -n 100 -c 50 <url>

ab -t 30 -c 50 <url>

acl

getfacl <file>

setfacl -m u:username:rX <file> setfacl -m g:groupname:rw <file> setfacl -m o::- <file>

setfacl -m u::rwx,g:groupname:rX,o::- <file>

getfacl file-A | setfacl -M - file-B

setfacl -R -m u:username:rX <directory>

setfacl -x u:username,g:groupname <file>

setfacl -b <file>

setfacl -m d:u:username:rx <directory> setfacl -x d:u:username <directory>

setfacl -k <directory>

ag

ag <phrase> --ignore-dir=<dir>

ag <phrase> --ignore=<file>

ag <phrase> --color | less -R

ag <phrase> -G <pattern>

alias

alias

alias word="command"

alias word

unalias word

alias rm="rm --interactive"

alias la="ls --all"

ansible

ansible-playbook <YAML>

ansible-playbook <YAML> -f 10

ansible-playbook <YAML> --verbose

ansible-playbook <YAML> -C

ansible-playbook <YAML> -C -D

ansible-playbook <YAML> -l <host>

ansible -u ansible -i inventory.yml servers -m shell -a "ls /var"

ansible-playbook --syntax-check <YAML>

ansible-galaxy

ansible-galaxy install <user>.<role>

ansible-galaxy remove <user>.<role>

ansible-galaxy list

ansible-galaxy search <role>

ansible-galaxy init <role>

ansible-galaxy role info <user>.<role>

ansible-vault

ansible-vault encrypt_string 'SupersecretPa$$phrase' --name 'backup_encryption_key'

apk

apk add <package>

apk del <package>

apk update

apk upgrade

apk search <package>

apt

apt search <phrase>

apt show <package>

apt update

apt upgrade

apt dist-upgrade

apt update && apt upgrade # use dist-upgrade carefully if needed

apt install <package>...

apt remove <package>...

apt autoremove

apt depends <package>...

apt purge <package>...

apt list --installed

apt-cache

apt-cache search <phrase>

apt-cache show <package>...

apt-cache rdepends <package>

apt-cache showpkg <package>

apt-cache policy <package>

apt-get

apt-get update

apt-get upgrade

apt-get dist-upgrade

apt-get update && apt-get dist-upgrade

apt-get install <package>...

apt-get download <package>

apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ...

grep 'install ' /var/log/dpkg.log

apt-get update -o DPkg::Options::='--force-confold' ...

at

at {time} {command 0} {command 1} Ctrl-d

now | midnight | noon | teatime (4pm) HH:MM now + N {minutes | hours | days | weeks} MM/DD/YY

atq

atrm {id}

awk

awk '{print $5}' filename

awk '/foo/ {print $2}' filename

awk -F ',' '{print $NF}' filename

awk '{s+=$1} END {print s}' filename

awk 'NR%3==1' filename

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' filename

awk '($10 == value)'

awk '($10 >= min_value && $10 <= max_value)'

bzip2

bzip2 -z foo

bzip2 -d foo.bz2

bzip2 -zc foo > foo.bz2

bzip2 -dc foo.bz2

cat

cat <file>

cat -n <file>

cat -b <file>

cd

cd path/to/directory

cd

cd ..

cd -

cd -P path/to/dir

chmod

chmod a+x myscript.sh

chmod u=rwx, go=r myscript.sh

chmod a-w myscript.sh

chmod = myscript.sh

chmod 644 myscript.sh

chmod 755 myscript.sh

chmod 666 myscript.sh

u - user (owner of the file) g - group (members of file's group) o - global (all users who are not owner and not part of group) a - all (all 3 roles above)

7 - full (rwx) 6 - read and write (rw-) 5 - read and execute (r-x) 4 - read only (r--) 3 - write and execute (-wx) 2 - write only (-w-) 1 - execute only (--x) 0 - none (---)

/bin/chmod -a# 0 /path/to/file

chown

chown <user> <file>

chown <user>:<group> <file>

chown <user>: <file>

chown :<group> <file>

chown -R <user> <directory>

chown --reference=<reference-file> <file>

cmp

syntax: bash cmp <path/to/file_1> <path/to/file_2>

cmp -b <path/to/file_1> <path/to/file_2>

cmp -b --verbose <path/to/file_1> <path/to/file_2>

cmp -i 100 <path/to/file_1> <path/to/file_2>

cmp -n 200 <path/to/file_1> <path/to/file_2>

cmp --quiet <path/to/file_1> <path/to/file_2>

comm

comm -12 <(sort file1.csv) <(sort file2.csv)

comm -23 <file-1> <file-2>

convert

convert original.jpg converted.pdf

convert original.jpg -resize 100x converted.jpg

convert original.jpg -resize x100 converted.jpg

convert original.jpg -resize 100x100 converted.jpg

convert original.jpg -resize 100x converted.png

for file in `ls original/image/path/`; do new_path=${file%.*}; new_file=`basename $new_path`; convert $file -resize 150 converted/image/path/$new_file.png; done

convert -density 150 arch1.pdf -quality 80 'output.jpg'

convert -density 150 arch1.pdf -quality 80 'output-%d.jpg'

cp

cp ~/Desktop/foo.txt ~/Downloads/foo.txt

cp -r ~/Desktop/cruise_pics/ ~/Pictures/

cp -i ~/Desktop/foo.txt ~/Documents/foo.txt

cp foo.txt{,."$(date +%Y%m%d-%H%M%S)"}

cp -P <symlink-dir> <dest-dir>

cp --sparse=always <src> <dest>

cpdf

cpdf in.pdf 1-3,6 -o out.pdf

cpdf in.pdf even -o out.pdf

cpdf -merge in.pdf in2.pdf AND -add-text "Copyright 2014" -o out.pdf

cpdf -control control.txt

cpdf -merge in.pdf in2.pdf -o out.pdf

cpdf -split in.pdf -o Chunk%%%.pdf -chunk 10

cpdf -split-bookmarks 0 in.pdf -o @N.pdf

cpdf -scale-page "2 2" in.pdf -o out.pdf

cpdf -scale-to-fit usletterportrait in.pdf -o out.pdf

cpdf -shift "26pt 18mm" in.pdf -o out.pdf

cpdf -rotate-contents 90 in.pdf -o out.pdf

cpdf -crop "0 0 600pt 400pt" in.pdf -o out.pdf

cpdf -encrypt 128bit fred joe in.pdf -o out.pdf

cpdf -decrypt in.pdf owner=fred -o out.pdf

cpdf -compress in.pdf -o out.pdf

cpdf -decompress in.pdf -o out.pdf

cpdf -list-bookmarks in.pdf

cpdf -add-bookmarks bookmarks.txt in.pdf -o out.pdf

cpdf -presentation in.pdf 2-end -trans Split -duration 10 -o out.pdf

cpdf -stamp-on watermark.pdf in.pdf -o out.pdf

cpdf -topleft 10 -font Courier -add-text "Page %Page\nDate %d-%m-%Y" in.pdf -o out.pdf

cpdf -twoup-stack in.pdf -o out.pdf

cpdf -pad-after 1,3,4 in.pdf -o out.pdf

cpdf -list-annotations in.pdf

cpdf -copy-annotations from.pdf in.pdf -o out.pdf

cpdf -set-title "The New Title" in.pdf -o out.pdf

cpdf -hide-toolbar true in.pdf -o out.pdf

cpdf -set-metadata metadata.xml in.pdf -o out.pdf

cpdf -set-page-layout TwoColumnRight in.pdf -o out.pdf

cpdf -set-page-mode FullScreen in.pdf -o out.pdf

cpdf -attach-file sheet.xls in.pdf -o out.pdf

cpdf -remove-files in.pdf -o out.pdf

cpdf -blacktext in.pdf -o out.pdf

cpdf -thinlines 2pt in.pdf -o out.pdf

crontab

* * * * * command_to_execute - - - - - | | | | | | | | | +- day of week (0 - 7) (where sunday is 0 and 7) | | | +--- month (1 - 12) | | +----- day (1 - 31) | +------- hour (0 - 23) +--------- minute (0 - 59)

*/15 * * * * /home/user/command.sh

0 0 * * * /home/user/command.sh

5 8 * * 6 /home/user/command.sh

% signs must be escaped such as \%

csplit

csplit <file> '/PATTERN/'

csplit -f 'prefix-' -b '%d.extension' <file> '/PATTERN/' '{*}'

curl

curl <url>

curl <url> -o <outfile>

curl -O <url> -O <url>

curl http://example.com/pic[1-24].jpg

curl -u <username>:<password> <url>

curl -x <proxy-host>:<port> <url>

curl -u <username>:<password> -O ftp://example.com/pub/file.zip

curl ftp://username:[email protected]

curl -C - -o <partial-file> <url>

curl -I <url>

curl http://ifconfig.me/all.json

curl --limit-rate 1000B -O <outfile>

curl httpbin.org/ip

curl -o /dev/null -w '%{http_code}\n' -s -I URL

date

date +"%a"

date +"%B"

date +"%F"

date +"%T"

date +"%U"

date +"%W"

date +"%X"

date +"%Y"

date +"%Z" date +"%Y%m%d_%H%M%S"

date -d @1440359821

date -r 1440359821

date +%Z

date -R

date -u

TZ=CET date

TZ='America/Los_Angeles' date

dd

dd if=/dev/urandom of=/tmp/test.txt count=2 bs=512

dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d /proc/$dd_pid ]]; do kill -USR1 $dd_pid && sleep 1 && clear; done

(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0

(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | zenity --title 'Running dd command (cloning), please wait...' --progress

dd if=/dev/zero of=/dev/null bs=128M status=progress

dcfldd if=/dev/zero of=/dev/null bs=500K

dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp

dd if=/dev/zero of=foo1 seek=1 bs=1M count=0

df

df -h

df -d <path>

diff

diff -u <file-1> <file-2>

diff -ur <dir-1> <dir-2>

diff -ub <file-1> <file-2>

diff -uB <file-1> <file-2>

diff -ui <file-1> <file-2>

diff -q <file-1> <file-2>

diff -s <file-1> <file-2>

diff <(command1) <(command2)

diff -Naur <file-1> <file-2> > <patch-file>

docker

docker -d

docker build -t <image-tag-name> <path-of-Dockerfile>

docker run -ti <image-name> /bin/bash

docker exec -ti <container-name> bash

docker inspect <container-name> (or <container-id>)

docker inspect --format {{.State.Pid}} <container-name-or-id>

docker inspect --format='{{json .Volumes}}' <container-id> | python -mjson.tool

docker cp foo.txt mycontainer:/foo.txt

docker ps

docker ps -a

docker rm $(docker ps -qa)

docker images

docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

docker volume prune

docker save -o <archive-name>.tar <image-name>

docker load -i <archive-name>.tar

docker image rm <image-name-or-id>

docker image tag <image-name>:<tag-name> <image-name>:<new-tag-name>

docker login

docker push <image-name>:<image-tag-name>

docker-compose

docker-compose up

docker-compose -f <path/to/compose_file.yml> up

docker-compose up -d

docker-compose up --build

docker-compose up <container_name_1> <container_name_2>

docker-compose ps

docker-compose stop

docker-compose down --rmi all --volumes

docker-compose logs --follow

docker-compose logs --follow <container_name>

docker-compose run <container_name> env

du

du -sk *| sort -rn

du -sh

du -shL

du -h --apparent-size

du -sh * | sort -rh

du -ma | sort -nr | head -n 20

env

env

env <variable>=<value> <command>

env <variable_1>=<value> <variable_2>=<value> <command>

env -u <variable> <command>

env -i <command>

ethtool

ethtool -S <interface>

ethotool -P <interface>

ethtool -s <interface> [ speed %d ]

ethtool -s <interface> [ autoneg on|off ]

ethtool -S <interface> | grep error

export

export

export VARNAME="value"

fd

fd <search query>

fd <search query> <directory>

fd -e <file extension> <search query>

fd -g <file name>.<file extension>

fd -H <search query>

fd -E <file or directories which should be excluded> <search query>

find

find -L . -type f

find . -iname "*.jpg"

find . -type d

find . -type f

find . -type f -perm 777

find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l

find . -type f -ctime -1 -print0 | xargs -0 -p cp -t <dir> find . -type f -ctime -1 -print0 | xargs -0 -p -J % cp % <dir>

find ./path/ -name '*.txt' -delete

find ./path/ -name '*~' -delete

find ./path/ -name '*.txt' -exec cat '{}' \;

find ./path/ -name '*.txt' | xargs grep 'string'

find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z

find . -type f -size +200000000c -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

find . -type f -mtime +7d -ls

find . -type l -user <username-or-userid> -ls

find . -type d -empty -exec rmdir {} \;

find . -maxdepth 2 -name build -type d

find . ! -iwholename '*.git*' -type f

find . -type f -samefile MY_FILE_HERE 2>/dev/null

find . -type f -exec chmod 644 {} \;

find . -type f -ctime -48h find . -type f -ctime -2 find . -type f -Btime -2 find . -type f -atime -2

find . -name '*,*' | while read f; do echo mv "$f" "${f//,/}"; done

find -L /usr/ports/packages -type l

find . -type f -exec sh -c "echo '{}'; cat '{}';" \;

fkill

fkill 1337

fkill safari

fkill :8080

fkill

free

free

free -b|k|m|g

free -h

free -s 2

fzf

fzf

cat $(fzf)

fzf +i

fzf -i

rm -rf $(fzf --multi)

fzf --preview "file {}"

find . -type f -name "*.txt" | fzf --preview "head {}"

fzf --border sharp

find . -type f "*.txt" | fzf --multi > output.txt

git

git config --global user.name <name> git config --global user.email <email>

git config --global core.editor <editor>

git config --global color.ui true

git add --all

git stash

git stash push -m <message>

git stash list

git stash pop

git stash apply stash@{6}

git commit -m <message>

git commit --amend

git commit --date="`date --date='2 day ago'`" git commit --date="Jun 13 18:30:25 IST 2015"

git filter-branch --env-filter \ 'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ] then export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800" export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700" fi'

git reset --hard

git reset --hard HEAD~2

git reset --hard <remote>/<branch>

git update-ref -d HEAD

git clean -f -d

git clean -f -d -x

git push origin master

git push [email protected]:<username>/<repo>.git

git tag -a <tag> <commit> -m "<commit message>"

git push origin <tagname>

git push --delete origin <tagname>

git tag -d <tagname>

git push -f

git branch -D <branch>

git branch -d <branch>

git push --delete origin <branch>

git branch --merged | egrep -v "(^*|main|dev)" | xargs git branch -d

git branch -u upstream/foo

git blame <file>

git remote add upstream [email protected]:<username>/<repo>.git # Set a new repo git remote -v # Confirm new remote repo git fetch upstream # Get branches git branch -va # List local - remote branches git checkout master # Checkout local master branch git checkout -b new_branch # Create and checkout a new branch git merge upstream/master # Merge remote into local repo git show 83fb499 # Show what a commit did. git show 83fb499:path/fo/file.ext # Shows the file as it appeared at 83fb499. git diff branch_1 branch_2 # Check difference between branches git log # Show all the commits git status # Show the changes from last commit

git log --pretty=email --patch-with-stat --reverse --full-index -- Admin\*.py > Sripts.patch

git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k

git log @{u}..

git log -p feature --not master git diff master...feature

git rebase -i @~7

git diff --no-index path/to/file/A path/to/file/B

git fetch --all git reset --hard origin/master

git pull <remote> <branch> --rebase

git submodule update --init --recursive

git clone --depth 1 <remote-url>

git pull --unshallow

git checkout --orphan branch_name

git checkout -b master upstream/master

git remote prune origin

git remote prune $(git remote | tr '\n' ' ')

git show :/cool

git checkout -p HEAD^ -- /path/to/file

git revert <commit SHA>

git cherry-pick <commit SHA1>

git commit --amend --author="Author Name <[email protected]>"

git config --global user.signingkey 0A46826A

git tag -s v1.5 -m 'my signed 1.5 tag'

git commit -a -S -m 'Signed commit'

git log --pretty="format:%h %G? %aN %s"

git config user.signingkey [KEYID]

git config --global commit.gpgsign true

git ls-files --others --exclude-standard

go

go run .

go run ./cmd/foo/

go get github.com/foo/[email protected] go get github.com/foo/bar@8e1b8d3

go get -u github.com/foo/bar

go build -o=/tmp/foo .

go build -o=/tmp/foo ./cmd/foo

go env GOCACHE

go build -a -o=/tmp/foo .

go clean -cache

GOOS=linux GOARCH=amd64 go build -o=/tmp/linux_amd64/foo . GOOS=windows GOARCH=amd64 go build -o=/tmp/windows_amd64/foo.exe .

go tool dist list

go list -m all

go mod why -m golang.org/x/sys

go clean -modcache

go doc strings

go doc -all strings

go doc strings.Replace

go doc sql.DB

go doc sql.DB.Query

go doc -src strings.Replace

go test .

go test ./...

go test ./foo/bar

go test -race ./...

go test -count=1 ./...

go clean -testcache

go test -v -run=^TestFooBar$ .

go test -v -run=^TestFoo .

go test -v -run=^TestFooBar$/^Baz$ .

go test -short ./...

go test -failfast ./...

go test all

go test -run=^TestFooBar$ -count=500 .

go fix ./...

go bug

go test -run=^$ -bench=^BenchmarkFoo$ -trace=/tmp/trace.out .

go tool trace /tmp/trace.out

go env

go env -w GOPATH=/foo/bar

go build -race -o=/tmp/foo . # not for production

grep

grep <pattern> <file>

grep -in <pattern> <file>

grep -R <pattern> <dir>

grep -f <pattern-file> <file>

grep -v <pattern> <file>

grep -B 3 -A 2 <pattern> <file>

grep "^00" <file> # Match lines starting with 00 grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" <file> # Find IP add

grep -rnw <dir> -e <pattern>

ps aux | grep '[h]ttpd'

ps aux | grep -E --color 'bash|$'

gzip

gzip test.txt

gzip -c test.txt > test_custom.txt.gz

gzip -d test.txt.gz

gzip -l *.gz

gzip -r documents_directory

gzip < test.txt > test.txt.gz

hardware-info

sudo lshw

lsmod

find /lib/modules/$(uname -r) -type f -iname "*.ko"

modprobe <module>

modprobe -r <module>

lspci

lspci -vvxxx

cat /proc/cpuinfo

cat /proc/meminfo

dmesg

dmesg --kernel

history

history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10

http

http PUT example.org X-API-Token:123 name=John

http -f POST example.org hello=World

http -v example.org

http -a USERNAME POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome!'

http example.org < file.json

http example.org/file > file

http --download example.org/file

http --session=logged-in httpbin.org/headers

http localhost:8000 Host:example.com

http PUT example.org name=John [email protected]

http PUT api.example.com/person/1 name=John age:=29 married:=false hobbies:='["http", "pies"]' [email protected] bookmarks:[email protected]

http POST api.example.com/person/1 < person.json

http --form POST api.example.org/person/1 name='John Smith' [email protected] cv=@~/Documents/cv.txt

http -f POST example.com/jobs name='John Smith' cv@~/Documents/cv.pdf

http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' X-Foo:Bar Referer:http://httpie.org/

http -a username:password example.org

http --auth-type=digest -a username:password example.org

http -a username example.org

cat ~/.netrc machine httpbin.org login httpie # password test http httpbin.org/basic-auth/httpie/test

http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org

http --proxy=http:http://user:[email protected]:3128 example.org

http --verify=no https://example.org

http --verify=/ssl/custom_ca_bundle https://example.org

http --cert=client.pem https://example.org

http --cert=client.crt --cert-key=client.key https://example.org

# --headers, -h Only the response headers are printed. # --body, -b Only the response body is printed. # --verbose, -v Print the whole HTTP exchange (request and response). # --print, -p Selects parts of the HTTP exchange. http --verbose PUT httpbin.org/put hello=world

# Character Stands for # ----------- ------------------- # H Request headers. # B Request body. # h Response headers. # b Response body. http --print=Hh PUT httpbin.org/put hello=world

http --headers PATCH example.org/Really-Huge-Resource name='New Name'

http PUT example.com/person/1 X-API-Token:123 < person.json

grep '401 Unauthorized' /var/log/httpd/error_log | http POST example.org/intruders

echo '{"name": "John"}' | http PATCH example.com/person/1 X-API-Token:123

http GET https://api.github.com/repos/jkbrzt/httpie | http POST httpbin.org/post

cat | http POST example.com <paste> # ^D cat | http POST example.com/todos Content-Type:text/plain - buy milk - call parents ^D

pbpaste | http PUT example.com

echo 'data' | http POST example.org more=data # This is invalid

http PUT httpbin.org/put @/data/file.xml

http example.org/Movie.mov > Movie.mov

http octodex.github.com/images/original.jpg | convert - -resize 25% - | http example.org/Octocats

http --pretty=all --verbose example.org | less -R

http --download https://github.com/jkbrzt/httpie/tarball/master

http -d https://github.com/jkbrzt/httpie/tarball/master | tar zxf -

http -dco file.zip example.org/file

http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track='Justin Bieber'

http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track=Apple | while read tweet; do echo "$tweet" | http POST example.org/tweets ; done

http --session=user1 -a user1:password example.org X-Foo:Bar

http --session=user1 example.org

http --session=user2 -a user2:password example.org X-Bar:Foo

http --session=/tmp/session.json example.orghttp --session=/tmp/session.json admin.example.orghttp --session=~/.httpie/sessions/another.example.org/test.json example.orghttp --session-read-only=/tmp/session.json example.org

ifconfig

ifconfig <interface>

ifconfig -a

ifconfig wlan0 {up|down}

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1

ip

ip addr

ip link set dev wlan0 {up|down}

ip addr add 192.168.1.100/32 dev eth0

ip addr del 192.168.1.100/32 dev eth0

ip address flush dev eth0

ip route

ip -6 route

ip route add default via 192.168.1.1

ip route add 192.168.0.0/24 dev eth0

ip route get to 8.8.8.8

ip link set dev eth0 address aa:bb:cc:dd:ee:ff

ip neighbor show

iwconfig

iwconfig wlan0

iwconfig wlan0 txpower {on|auto|off}

iwconfig wlan0 mode {managed|ad-hoc|monitor}

journalctl

journalctl -f

journalctl -b -p err

journalctl --since=2012-10-15 --until="2011-10-16 23:59:59"

journalctl -F _SYSTEMD_UNIT

journalctl -u dbus

journalctl /usr/bin/dbus-daemon

journalctl _PID=123

journalctl _COMM=sshd

journalctl _COMM=crond --since '10:00' --until '11:00'

journalctl --list-boots

journalctl _UID=1000

journalctl -t systemd-resolved

jq

jq "." < filename.json

jq '.foo'

jq '.[0]'

jq '.[2:4]' jq '.[:3]' jq '.[-2:]'

jq keys

jq '.foo | sort_by(.bar)'

jq '.foo | length'

jq '.foo[] | {field_1,field_2}'

jq '.foo[] | {field_1,field_2} | join(" ")'

jq '.foo[] | select(.field_1 == "value_1")'

kill

kill -15 <pid>

kill -9 <pid>

kubectl

kubectl -h

kubectl command_name -h

kubectl api-resources

Pods, nodes, services, deployment, replicasets, statefulsets, volumes ...

kubectl explain resource_name

kubectl explain resource_name.field_name

kubectl options

source <(kubectl completion bash)

kubectl create -f ./file.yml

kubectl create -f ./dir

kubectl apply -f ./dir

kubectl get <resources> :services,nodes,pods

kubectl describe <resources> <resource-name>

kubectl apply -f ./file.yml

kubectl get all -A

kubectl get events --sort-by='.metadata.creationTimestamp'

kubectl config use-context CONTEXT_NAME [options]

kubectl label pods <pod-name> new-label=awesome

kubectl annotate pods <pod-name> icon-url=http://goo.gl/XXBTWq

kubectl logs <pod-name>

kubectl run -i --tty busybox --image=busybox -- sh

kubectl attach <podname> -i

kubectl port-forward <podname> <local-and-remote-port>

kubectl port-forward <servicename> <port>

kubectl exec <pod-name> -- ls /

kubectl exec <pod-name> -c <container-name> -- ls /

less

G

g

v

/<searchterm>

&

n

N

Alt-u

F less +F <filename>

less -X

:n

:p

less -S <filename> -S

s <filename>

Type g or < (g or less-than) | $ (pipe then dollar) then cat > <filename> and Enter.

ln

ln -s <source-location> <symlink-location>

ln -sf <source-location> <symlink-location>

ls

ls <dir>

ls -a <dir>

ls -lh <dir>

ls -S <dir>

ls -d */ <dir>

ls -d .*/ */ <dir>

ls -ltc

ls -lt

ls -1

/bin/ls -le

lscpu

lscpu

lscpu --extended

lscpu --extended --offline

lsof

sudo lsof -i4

sudo lsof -i6

lsof -i

lsof -Pnl +M -i4

lsof -i TCP:80

lsof [email protected]

lsof <path>

lsof -u <username>

lsof -c <command>

lsof -p <pid>

lsof +f -- <mount-point>

man

man -t bash | ps2pdf - bash.pdf

man 7 ascii

cat /private/etc/man.conf

markdown

> first level and paragraph >> second level and first paragraph > > first level and second paragraph

To create a collapsible section (collapsed by default) showing the text "Collapsed Item Title", use this: <details> <summary>Collapsed Item Title</summary> <p>Collapsed content</p> <p>Other collapsed content.</p> </details>

Sub-bullets can be done with 2+ spaces or 1 tab * Red * sub-bullet * sub-sub-bullet * Green - sub with dash + sub with plus * Blue

1. First 1. First sub-item <-- this is the best supported format 2. Second * Unordered <-- this also appears to be a widely supported format 3. Third a. Lettered <-- there is mixed support for this format 4. Fourth i. using roman numerals <-- there is mixed support for this format ii. more stuff

There is limited support for rendering check lists: - [ ] incomplete task - [ ] incomplete sub-task - [x] complete sub-task - [x] complete task

regular text code code code

or a code block (optionally specifying the language, more details here: https://rdmd.readme.io/docs/code-blocks): ```shell alias ltr='ls -ltr' alias latr='ls -latr' ```

***

The "Title" is optional This is [an example](http://example.com "Title") inline link.

![Alt Text](/path/to/file.png)

Italic: *em* _em_ Bold: **strong** __strong__ ~~strikethrough~~

minikube

minikube start --vm-driver=virtualbox

minikube docker-env

minikube dashboard

minikube service list

minikube service <service>

mkdir

mkdir -p foo/bar/baz

mkdir -p foo/{bar,baz}

mkdir -p foo/{bar,baz/{zip,zap}}

more

more +5 <file>

mount

mount -o remount,rw /

mount --bind <source> <destination>

mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx

mount -t nfs <host>:<remote-dir> <local-dir>

mount -o loop disk1.iso /mnt/disk

multipass

multipass

multiplass list

multipass find

multipass launch -v --name todelete

mv

mv <src> <dest>

mv -f <src> <dest>

mv -i <src> <dest>

mv -n <src> <dest>

mv -t <dest> <file>...

mysql

mysql -h <host> -u <username> -p

mysqldump --all-databases --all-routines -u <username> -p > ~/dump.sql

mysql -u <username> -p < ~/fulldump.sql

CREATE DATABASE owa CHARACTER SET utf8 COLLATE utf8_general_ci;

GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'IDENTIFIED BY 'password' WITH GRANT OPTION;

SHOW GRANTS FOR CURRENT_USER(); SHOW GRANTS; SHOW GRANTS FOR CURRENT_USER;

SELECT * FROM tbl_name;

INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2);

UPDATE tbl_name SET col1 = "example";

DELETE FROM tbl_name WHERE user = 'jcole';

SHOW PROCEDURE STATUS;

SHOW FUNCTION STATUS;

nc

nc -p <src-port> -w <seconds> <dest-host> <dest-port>

nc -u <dest-host> <dest-port>

nc -s <source-host> <dest-host> <port>

nc -lU /var/tmp/dsocket

nc -x<proxy-host>:<proxy-port> -Xconnect <dest-host> <dest-port>

nc -x<proxy-host>:<proxy-port> -Xconnect -Pruser <host> <port>

nc -zv -s source_IP target_IP Port

ncat

ncat <host> [<port>]

ncat -l [<host>] [<port>]

ncat -l [<host>] [<port>] < file

ncat -l --keep-open [<host>] [<port>] < file

ncat [<host>] [<port>] > file

ncat -l --broker [<host>] [<port>]

ncat -l --ssl [<host>] [<port>]

ncat -l --allow <ip> ncat -l --deny <ip>

ncat --proxy <proxyhost>[:<proxyport>] --proxy-type {http | socks4} <host>[<port>]

ncat -l --chat [<host>] [<port>]

netstat

sudo netstat -lnptu

netstat -r

netstat -pln | grep <port> | awk '{print $NF}'

sudo netstat -vtlnp --listening -4

ss

ip route

ip -s link

ip maddr

nmap

nmap [target]

nmap -iL [list.txt]

nmap -6 [target]

nmap -O --osscan_guess [target]

nmap -oN [output.txt] [target]

nmap -oX [output.xml] [target]

nmap -source-port [port] [target]

nmap -A [target]

nmap -T5 --min-parallelism=50 -n --min-rate=300 [target]

nmap -traceroute [target]

nmap -sP 192.168.0.0/24

nmap --script default,safe

nmap --script default,banner,/home/user/customscripts

nmap --script 'http-*'

nmap --script "not intrusive"

nmap --script "default and safe"

nmap --script "(default or safe or intrusive) and not http-*"

nmap -T5 --min-parallelism=50 -n --script "ssl-heartbleed" -pT:443 127.0.0.1

nmap -d ...

nmap -p 22 192.168.0.0/24

The most common Nmap scripting engine categories: - auth: Utilize credentials or bypass authentication on target hosts. - broadcast: Discover hosts not included on command line by broadcasting on local network. - brute: Attempt to guess passwords on target systems, for a variety of protocols, including http, SNMP, IAX, MySQL, VNC, etc. - default: Scripts run automatically when -sC or -A are used. - discovery: Try to learn more information about target hosts through public sources of information, SNMP, directory services, and more. - dos: May cause denial of service conditions in target hosts. - exploit: Attempt to exploit target systems. - external: Interact with third-party systems not included in target list. - fuzzer: Send unexpected input in network protocol fields. - intrusive: May crash target, consume excessive resources, or otherwise impact target machines in a malicious fashion. - malware: Look for signs of malware infection on the target hosts. - safe: Designed not to impact target in a negative fashion. - version: Measure the version of software or protocols on the target hosts. - vul: Measure whether target systems have a known vulnerability.

nmcli

nmcli d wifi connect <ssid> password <pass> iface <wiface>

nmcli d wifi disconnect iface <wiface>

nmcli radio wifi

nmcli radio wifi <on|off>

nmcli dev wifi list

nmcli dev wifi rescan

nmcli con

nmcli con show --active

nmcli dev status

nmcli con add type ethernet con-name <name> ifname <iface_name>

nmcli con import type openvpn file <path_to_ovpn_file>

nmcli con up <name>

nmcli dev wifi show

npm

npm install <package>

npm install --save <package>

npm install --save-dev <package>

npm outdated

npm update

npm install -g npm

npm uninstall <package>

npm config set //npm.intra/:_authToken=\${NPM_TOKEN}

ntp

service ntp status

service ntp start

sudo hwclock -r

sudo hwclock --systohc

sudo hwclock --hctosys

sudo hwclock --localtime

sudo hwclock --utc

sudo hwclock --set --date="8/10/15 13:10:05"

ntpq -pn

/etc/ntp.conf

/var/lib/ntp/ntp.drift

od

od <binary-file> od -o <binary-file> od -t o2 <binary-file>

od -x <binary-file> od -t x2 <binary-file>

od -A x -t x1 <binary-file>

openssl

openssl genrsa -out server.key 2048

openssl req -new -key server.key -out server.csr

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

openssl req -text -noout -in server.csr

openssl x509 -text -noout -in server.crt

openssl x509 -in server.crt -noout -sha256 -fingerprint

echo | openssl s_client -connect <hostname>:443 2> /dev/null | \ awk '/-----BEGIN/,/END CERTIFICATE-----/' | \ openssl x509 -noout -enddate

openssl dhparam -outform PEM -out dhparams.pem 2048

openssl s_client -connect 10.240.2.130:433

pass

pass init <gpg-id>

pass init -p <path-to-directory> <gpg-id-1> <gpg-id-2>

pass insert [-m|--multiline] <path-to-data>

pass generate <path-to-data> <n>

pass

pass edit <path-to-data>

pass <path-to-data>

pass -c <n> <path-to-data>

pass git init

paste

paste <file>...

ls | paste - - -

paste -s -d '\t\n' <file>

sed = <file> | paste -s -d '\t\n' - -

find / -name bin -type d | paste -s -d : -

patch

patch <file> < <patch-file>

patch -R <file> < <patch-file>

$ cd dir $ patch -p1 -i <dir> <patch-file>

patch -p1 -r <dir> < <patch-file>

pgrep

pgrep <pattern>

pgrep -f <pattern> | xargs kill

ping

ping -c 15 <host>

ping -c 15 -i .5 <host>

ping -s 1500 -c 10 -M do <host>

ping6 -I eth0 ff02::1

pip

pip search <package>

pip install <package>...

pip install --user <package>

pip install --upgrade <package>

pip freeze > requirements.txt pip install -r requirements.txt

pip show <package>

pip list --outdated

pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U

pip list --outdated --format=freeze | cut -d = -f 1 | xargs -n1 pip install -U

pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4'

pkill

pkill <process-name>

pkill -f <string>

podman

podman ps

podman ps -a

podman pull vaultwarden/server:latest

podman images

podman rm <container-name>

ps

ps aux

ps axjf

ps -aufoouser

ps -eo pid,user,command

ps aux | grep '[h]ttpd'

psql

psql -U <username> -h <host> -d <database>

psql -U <username> -h <host> --list

psql -U <username> -d <database> -c 'select * from tableName;' -o <outfile>

psql -U <username> -d <database> -H -c 'select * from tableName;'

psql -U <username> -d <database> -c 'copy (select * from tableName) to stdout with csv header;' -o <outfile>

psql -f <outfile>

psql -f <outfile> <username>

pwd

pwd

pyenv

pyenv install <version>

pyenv global <version>

pyenv local <version>

pyenv virtualenv <version> <virtualenv_name>

pyenv uninstall <version>

pyenv versions

pyenv version

python

python -m SimpleHTTPServer python -m http.server 8000

python -m smtpd -n -c DebuggingServer localhost:1025

python -m json.tool foo.json

reboot

shutdown -r 22:00

regex

[...]: Any one character between the brackets. [^...]: Any one character not between the brackets. [0-9]: It matches any decimal digit from 0 through 9. [a-z]: It matches any character from lowercase a through lowercase z. [A-Z]: It matches any character from uppercase A through uppercase Z. [a-Z]: It matches any character from lowercase a through uppercase Z.

p+: It matches any string containing at least one p. p*: It matches any string containing zero or more ps. p?: It matches any string containing one or more ps. p{N}: It matches any string containing a sequence of N ps. p{2,3}: It matches any string containing a sequence of two or three ps. p{2, }: It matches any string containing a sequence of at least two ps. p$: It matches any string with p at the end of it. ^p: It matches any string with p at the beginning of it.

Alphanumeric: Itself. \0: The NUL character (\u0000). \t: Tab (\u0009). \n: Newline (\u000A). \v: Vertical tab (\u000B). \f: Form feed (\u000C). \r: Carriage return (\u000D).

.: a single character. \s: a whitespace character (space, tab, newline). \S: non-whitespace character. \d: a digit (0-9). \D: a non-digit. \w: a word character (a-z, A-Z, 0-9, _). \W: a non-word character. [\b]: a literal backspace (special case). [aeiou]: matches a single character in the given set. [^aeiou]: matches a single character outside the given set. (foo|bar|baz): matches any of the alternatives specified.

Matching a Username: ^[a-z0-9_-]{3,16}$ Matching a Password: ^[a-z0-9_-]{6,18}$ Matching a Hex Value: ^#?([a-f0-9]{6}|[a-f0-9]{3})$ Matching a Slug: ^[a-z0-9-]+$ Matching an Email: ^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$ Matching a URL: ^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$ Matching an IP Address: ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ Matching an HTML Tag: ^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$

rename

rename 'y/A-Z/a-z/' *

rename 's/sometext/replacedby/' *

rm

rm -rf <dir>

rm -f <dir>

find /tmp/ -inum 6666 -exec rm -i '{}' \;

rmdir

rmdir [option] directory_name

rmdir -v directory_name

rmdir-p directory_name

rmdir --help

rmdir --version

route

route -n

route add default gateway 192.168.0.1

route add -net 127.0.0.0 netmask 255.0.0.0 dev lo

route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0

route del default

route add default gw mango-gw

route add ipx4 sl0

route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4

route add -net 10.0.0.0 netmask 255.0.0.0 reject

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

rpm

rpm -ivh <rpm>

rpm -Uv <rpm>

rpm -e <package>

rpm -e --nodeps <package>

rpm -qf <file>

rpm -ql <package> rpm -qpl <rpm>

rpm -q --whatrequires <package> rpm -q --whatrequires <file>

rpm -qa

rpm -i --test <package>

rpm -K <package>

rpm -V <package>

rsync

rsync -avz host:file1 :file1 /dest/ rsync -avz /source host:/dest

rsync -avc <src> <dest>

rsync -auv /src/foo /dest

rsync -auv /src/foo/ /foo_bak

rsync -avz -e "ssh -p1234" <source> <username>@<host>:<dest>

rsync -avz -e "ssh -i ~/.ssh/id_rsa" <src> <dest>

rsync -avz --rsync-path="sudo rsync" user@<src> <dest>

find /path/to/files -type l -print | \ rsync -av --files-from=- /path/to/files user@targethost:/dest_path

salt

salt-key -L

salt-key -A

salt-key -a <target>

salt-key -D <target>

salt <target> test.ping

salt-run jobs.active

salt <target> saltutil.kill_job <job_id>

salt-cp <target> <source> <dest>

salt <target> cp.get_file salt://<source> <destination>

salt <target> cp.push <source>

salt <target> state.apply <state_name>

sar

sar -u 2 5

sar -P 1 1 3

sar -r 1 3

sar -S 1 3

sar -F 2 5

sar -d 1 3

sar -n DEV 1 3 | grep -v lo

scd

scd -ar ~/Documents/

scd doc

scd a b c

scd "ts$"

scd -v

scd --alias=xray

scd xray

scp

scp <file> <user>@<host>:<dest>

scp <user>@<host>:<src> <dest>

scp -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" <file> <user>@<host>:<dest>

scp -3 <user>@<host1>:<src> <user>@<host2>:<dest>

screen

screen -S <session-name>

Press Ctrl+A then press d

screen -r <session-name>

screen -ls

screen -XS <session-name> quit

sed

sed 's/day/night/g' <file>

sed -i 's/day/night/g' <file>

echo 'It is daytime' | sed 's/day/night/g'

sed -i -r 's/^\s+//g' <file>

sed '/^$/d' <file>

sed ':a;N;$!ba;s/\n//g' <file>

sed '/Once upon a time/i\Chapter 1'

sed '/happily ever after/a\The end.'

selinux

getenforce sestatus cat /etc/selinux/config

setenforce 0

ls -Z ps -Z ss -Z id -Z

getsebool -a

setsebool foo_bar 1 -P

sudo cat /var/lib/selinux/targeted/active/booleans.local

sudo chcon -t foo_bar_t /foo/bar/baz.txt sudo restorecon -vR /foo/bar/

sudo semanage fcontext -a -t httpd_sys_content_t "/foo(/.*)?" sudo semanage -a -e /var/www/html /foo sudo restorecon -vR /foo

sudo dnf install setroubleshoot sudo journalctl -t setroubleshoot

sudo setenforce 0 sudo journalctl sudo sealert -l <uuid> grep foobar /var/log/audit/audit.log | audit2allow -M mypol sudo semodule -i mypol.pp

sudo dnf install policycoreutils-gui

sha256sum

sha256sum <file>

sha256sum Some text ^D

sha256sum --check <file-with-list-of-checksums>

sha256sum --check --ignore-missing <file-with-list-of-checksums>

shred

shred -n 5 -v <file>

shred -n 5 -vz <file>

shred -n 5 -vzu <file>

shred -n 5 -vz /dev/sda

shutdown

shutdown -r now

shutdown -h now

shutdown -r +5

shutdown -c

slurm

sbatch job.sh

squeue -u <user>

scancel <job-id> scancel --name <job-name>

scontrol show jobid -dd <job-id>

sstat --format=AveCPU,AvePages,AveRSS,AveVMSize,JobID -j <job-id> --allsteps

smbclient

smbclient -L <host> -U%

smbclient //<host>/<share> -U<user>%<password>

snap

snap find <package>

snap info <package>

snap find --private

sudo snap install <package>

sudo snap install <package> --channel=beta

snap list

snap list --all

sudo snap refresh

sudo snap refresh <package>

sudo snap refresh <package> --channel=beta

sudo snap revert <package>

snap revert <package> --revision 5

sudo snap remove <package>

sudo snap login

snap logout

snap changes

snap change 123

snap watch 123

snap abort 123

snap download <package>

snap ack foo.assert snap install foo.snap

snap install --dangerous foo.snap

snap install --devmode foo

snap install --classic foo

snap interfaces

snap connect foo:camera :camera

snap disconnect foo:camera

snap disable foo

snap enable foo

snap set foo bar=10

snap get foo bar

snmpwalk

snmpwalk -Os -c public -v 1 zeus system

snmpwalk -Os -c public -v 1 -CE sysORTable zeus system

sockstat

sudo sockstat -l

sort

sort <file>

sort -u <file>

sort -r <file>

sort -R <file>

split

split <file> -l 1000

split <file> -b 10M

cat x* > <file>

sqlite3

sqlite3 <database>

sqlite3 <database> "create table os(id integer primary key, name text, year integer);"

sqlite3 <database> "insert into 'os' values(1,'linux',1991);"

sqlite3 <database> ".tables"

sqlite3 <database> ".schema 'os'"

sqlite3 <database> "select * from 'os';"

sqlite3 <database> "select * from 'os' where year='1991';"

sqlite3 <database> "select * from 'os' where year like '19%';"

sqlite3 <database> ".import /path/to/city.csv cities"

sqlmap

./sqlmap.py --url="<url>" --data="<post-data>" --banner

./sqlmap.py -r <request-file> <options>

./sqlmap.py -r <request-file> --fingerprint

./sqlmap.py -r <request-file> --current-user --current-db --hostname

./sqlmap.py -r <request-file> --is-dba

./sqlmap.py -r <request-file> --users --passwords

./sqlmap.py -r <request-file> --dbs

./sqlmap.py -r <request-file> -D <db-name> --tables

./sqlmap.py -r <request-file> -D <db-name> --columns --schema --count ./sqlmap.py -r <request-file> -D <db-name> -T <tbl-name> -C <col-name> -U <user-name>

./sqlmap.py -r <request-file> -D <db-name> -T <tbl-name> -C <col-name> --dump

./sqlmap.py -r <request-file> --sql-query="<sql-query>"

./sqlmap.py -r <request-file> --prefix="<sql-query>" --suffix="<sql-query>"

./sqlmap.py -r <request-file> --os-shell

ss

ss -tlp

ss -t dst 192.168.2.1:80

ss -t state established '( dport = :ssh or sport = :ssh )'

ssh

ssh -i <pemfile> <user>@<host>

ssh -p <port> <user>@<host>

ssh -A <user>@<host>

ssh -t <user>@<host> 'the-remote-command'

ssh -oKeXAlgorithms=+diffie-hellman-group-exchange-sha1 <user>@<server>

ssh -X <user>@<host>

ssh -f -L 8080:remote.example.com:5000 [email protected] -N

ssh -X -t <user>@<host> 'chromium-browser'

ssh -qND <port> <user>@<host>

ssh -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" <user>@<host>

ssh <user>@<host> -C -c blowfish -X

ssh <user>@<host> "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf -

sshfs <user>@<host>:/path/to/folder /path/to/mount/point

emacs /ssh:<user>@<host>:<file>

ssh-add

ssh-add <keyfile>

ssh-add -K

ssh-add -K ~/.ssh/github_rsa

ssh-add -L

ssh-add -l

ssh-add -d <keyfile>

ssh-add -D

ssh-copy-id

ssh-copy-id <user>@<host>

ssh-copy-id <user>@<host> -p 2222

ssh-copy-id -i ~/.ssh/a_public_key.pub "username@host -p 2222"

ssh-keygen

ssh-keygen -t rsa

ssh-keygen -t rsa -b 4096

ssh-keygen -t ed25519-sk

ssh-keygen -t ed25519-sk -O resident

ssh-keygen -p -P <old-passphrase> -N <new-passphrase> -f <keyfile>

ssh-keygen -p -P <old-passphrase> -N '' -f <keyfile>

ssh-keygen -t rsa -b 4096 -C "$USER@$HOSTNAME" -P <passphrase>

ssh-keygen -lf <keyfile>

ssh-keygen -E md5 -lf <keyfile>

ssh-keygen -K

ssh-keygen -y -f <private-key-file> > <public-key-file> ssh-keygen -y -f ~/.ssh/private-key > ~/.ssh/public-key.pub

stdout

some-command 2>&1

some-command > <file>

some-command 2> <file>

some-command > <file> 2>&1

strace

strace <command>

strace -o <outfile> <command>

strace -e trace=open <command>

strace -e trace=file <command>

strace -e trace=process <command>

strace -f <command>

strace -c <command>

strace -p <pid>

su

su <user>

sudo

sudo -E <cmd>

svn

svn update "/path"

svn status

svn diff "/path/filename"

svn add "path/item"

svn revert "/path/file"

svn commit -m "message" "/path"

svn help diff

systemctl

systemctl

systemctl status foo.service

systemctl start/restart/stop foo.service

systemctl reload foo.service

systemctl edit foo.service

systemctl daemon-reload

systemctl enable foo.service

systemctl disable foo.service

systemctl --user start/restart/stop emacs.service

systemctl list-units

systemctl list-units -at service

systemctl list-units -t service --state running

systemctl list-unit-files -at service

systemctl list-units --all --state=inactive

systemctl list-unit-files

journalctl -b

journalctl -k

journalctl -b -u foo.service

systemctl list-dependencies foo.service

systemctl show foo.service

systemctl list-units --type=target

systemctl isolate foo.target

systemctl enable foo.target

systemd

systemd-analyze

systemd-analyze blame

systemctl list-units

systemctl enable foo.service

systemctl <start | stop> foo.service

/etc/systemd/system /usr/lib/systemd/system

tail

tail <file>

tail -n <number> <file>

tail -n +<number> <file>

tail -c <number> <file>

tail -f <file>

tar

tar -xvf /path/to/foo.tar

tar -xvf /path/to/foo.tar -C /path/to/destination/

tar -cvf /path/to/foo.tar /path/to/foo/

tar -xzvf /path/to/foo.tgz tar -xzvf /path/to/foo.tar.gz

tar -czvf /path/to/foo.tgz /path/to/foo/ tar -czvf /path/to/foo.tar.gz /path/to/foo/

tar -tzvf /path/to/foo.tgz tar -tzvf /path/to/foo.tar.gz

tar -xjvf /path/to/foo.tar.bz2

tar -cjvf /path/to/foo.tar.bz2 /path/to/foo/

tar -tjvf /path/to/foo.tar.bz2

tar -czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/

tar -z ... -> tar -Ipigz ... tar -j ... -> tar -Ipbzip2 ... tar -J ... -> tar -Ipixz ...

tarsnap

tarsnap -c -f <archive-name> /usr/home /other/stuff/to/backup

tarsnap -c -f <archive-name> --dry-run --print-stats <directories...>

tarsnap -c -f <target-archive-name> @@<source-archive>

tarsnap --list-archives

tarsnap -d -f <archive-name>

tarsnap -tv -f <archive-name>

tarsnap -x -f <archive-name> usr/home/alice usr/home/bob

tee

ls | tee <outfile>

ls | tee -a <outfile>

ls | tee /dev/tty | xargs printf "\033[1;34m%s\033[m\n"

terraform

terraform init

terraform fmt

terraform validate

terraform apply

terraform destroy

terraform init -upgrade

terraform get -update

tidy

tidy -i -wrap 160 -o output.html input.html

timedatectl

timedatectl set-timezone Europe/Paris

top

top -i <interval>

top -s <delay>

top -a

top -d

top -e

top -F

top -f

top -h

top -o <key>

tree

tree

tree <dir>

tree --prune

tree -a

tree -d -L 2

truncate

truncate -s 0 <file>

truncate -s 100 <file>

truncate -s 100K <file>

udisksctl

udisksctl info -b <device>

udisksctl mount --block-device <device>

udisksctl unmount --block-device <device>

udisksctl help

ulimit

ulimit -a

ulimit -n unlimited

uname

uname -a

uname -n

uname -r

uname -v

uname -m

uname -s

uname -o

uniq

sort <file> | uniq

sort <file> | uniq -u

sort <file> | uniq -d

sort <file> | uniq -c

sort <file> | uniq -uc

sort <file> | uniq -dc

unzip

unzip <archive>

unzip <archive> -d <directory>

unzip -tq <archive>

unzip -l <archive>

uptime

uptime [option]

uptime

uptime -p

uptime -s

uptime -V

uptime -h

usermod

sudo usermod -aG sudo <username>

vagrant

vagrant init

vagrant box add hashicorp/precise32

vagrant up

vagrant ssh

vagrant halt

vagrant suspend

vagrant destroy

vagrant reload --provision

virsh

virsh connect qemu:///system

virsh list --all

virsh dumpxml guest_id > path/to/guest.xml

virsh create path/to/config_file.xml

virsh edit guest_id

virsh command guest_id

virsh save guest_id filename

virsh destroy guest_id && virsh undefine guest_id

virtualenv

virtualenv /path/to/project/env_name

virtualenv --system-site-package /path/to/project/env_name

virtualenv /path/to/project/env_name -p /usr/bin/python/3.4

source /path/to/project/env_name/bin/activate

deactivate

pip install --user virtualenvwrapper export WORKON_HOME=~/.virtualenvs mkdir -p $WORKON_HOME source ~/.local/bin/virtualenvwrapper.sh

mkvirtualenv env_name

workon env_name

deactivate

rmvirtualenv env_name

wc

wc -w <file> cat <file> | wc -w

wc -l <file> cat <file> | wc -l

wc -c <file> cat <file> | wc -c

ls | wc -l

ls -l | wc -l | xargs

wget

wget <url> wget <url>...

wget <url> -O <outfile>

wget -P <dir> <url>

wget -c <url>

wget -i url_list.txt

wget -pk <url>

wget -mk <url>

wget http://example.com/files-{1..15}.tar.bz2

wget -r -l1 -A.extension http://example.com/directory

wget -S --spider -O - <url>

wget -U 'toto' <url>

wget --limit-rate=500k <url>

xmlto

xmlto pdf mydoc.xml

xmlto -o html-dir html mydoc.xml

xmlto html-nochunks mydoc.xml

xmlto -m ulink.xsl pdf mydoc.xml

xmlto -x mystylesheet.xsl pdf mydoc.xml

xxd

echo '42 is the solution' | xxd -p

echo '34322069732074686520736f6c7574696f6e0a' | xxd -r -p

zoneadm

zoneadm -z <zone> halt

zoneadm -z <zone> halt zoneadm -z <zone> uninstall

zoneadm -z <zone> verify

zoneadm -z <zone> install

zoneadm -z <zone> boot

zoneadm -z <zone> reboot

zoneadm list -cv