A.K.A. Commands I keep forgetting no matter how many milions time I type them

  • usermod -aG sudo $USER add user to sudoers
  • exec su -l $USER Reload a Linux user’s group assignments without logging out
  • script record (and play) shell session
  • xclip -sel clip < TEXTFILE copy file to default clipboard
  • hdparm -S 240 /dev/sda hdd spindown time
  • /sys/class/backlight/intel_backlight/brightness or /sys/devices/platform/thinkpad_acpi/leds/tpacpi\:\:power/brightness thinkpad backlight PWM endpoint
  • rsync -avzP user@host:$SOURCE user@host:$DEST
  • curl -d '{"MyKey":"My Value"}' -H "Content-Type: application/json" $ENDPOINT:$PORT/ curl JSON
  • curl -d @payload.json -H "Content-Type: application/json" $ENDPOINT:$PORT/ curl JSON file
  • nmcli dev wifi con "$SSID" password "$PASSPHRASE"
  • ssh -L $REMOTEPORT:localhost:$LOCALPORT $USER@$REMOTEHOST SSH loopback a.k.a. $REMOTEHOST:$REMOTEPORT is available at localhost:$LOCALPORT ssh tunneled/encrypted
  • GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'kaf500!'; MySQL, init wp tables
  • hostnamectl
  • visudo and append $USER ALL=(ALL) NOPASSWD: ALL

SSH

  • ssh-copy-id -i $PUBLICKEY $USERNAME@$HOST

GPG

Use ECC + ECC (ed25519) with Curve 25519 (cv25519) as elliptic curve.

  • gpg --list-keys list keys with key-ids
  • gpg --list-keys --with-fingerprint list keys in keyring with fingerprints/subkeys
  • gpg --list-kets --format LONG also show subkeys ID
  • gpg --full-generate-key key generation wizard
  • gpg --full-generate-key --expert enable more encryption algorithms
  • gpg --import $FILE import key (both public/public parts)
  • gpg --edit-key $FINGERPRINT, gpg> trust trust
  • gpg --armor --export $KEYID ASCII encoded export
  • gpg --export-secret-keys -a $KEYID
  • gpg --keyserver http://keys.gnupg.net:11371/ --send-key $KEYID, submit to keyserver
  • wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - download and add key as trusted pipe

git

  • git log -10 --format="%cd %s"
  • git log -1 --format=%cd
configuration

Adding --global applies these settings as default/system wide and not only in current repo.

  • git config user.email $EMAIL
  • git config user.name $NAME
  • git config gpg.program gpg set gpg executable
  • git config commit.gpgsign true enable gpg-signing commits
  • git config user.signingkey $FULLFINGERPRINT set default gpg key to use when signing commits

Common Locations

  • ~/.local/share/applications user-relative launchers
  • /usr/share/applications or /usr/local/share/applications global launchers