A.K.A. Commands I keep forgetting no matter how many milions time I type them
Magic SysRq key commands
The magic SysRq key is a key combination understood by the Linux kernel, which allows the user to perform various low-level commands regardless of the system’s state.
ALT + SysRq key (usually Stamp) + ..
fto call oom_kill
Remove kernel module manually installed with make/dkms
If you get stuff like:
hid-nintendo.ko:
Running module version sanity check.
Module version for hid-nintendo.ko
exactly matches what is already found in kernel 6.1.0-4-amd64.
DKMS will not replace this module.
You may override by specifying --force.
Error! Installation aborted.
Error! One or more modules failed to install during autoinstall.
during a kernel upgrade/reubild, and that module was not installed from a package:
dkms list
dkms remove <NAME/VERSION> --all
will clean it up. Re run apt upgrade to continue the kernel building.
miscellanea
usermod -aG sudo $USERadd user to sudoersexec su -l $USERReload a Linux user’s group assignments without logging outscriptrecord (and play) shell sessionxclip -sel clip < TEXTFILEcopy file to default clipboardhdparm -S 240 /dev/sdahdd spindown time/sys/class/backlight/intel_backlight/brightnessor/sys/devices/platform/thinkpad_acpi/leds/tpacpi\:\:power/brightnessthinkpad backlight PWM endpointrsync -avzP user@host:$SOURCE user@host:$DESTcurl -d '{"MyKey":"My Value"}' -H "Content-Type: application/json" $ENDPOINT:$PORT/curl JSONcurl -d @payload.json -H "Content-Type: application/json" $ENDPOINT:$PORT/curl JSON filenmcli dev wifi con "$SSID" password "$PASSPHRASE"ssh -L $REMOTEPORT:localhost:$LOCALPORT $USER@$REMOTEHOSTSSH loopback a.k.a. $REMOTEHOST:$REMOTEPORT is available at localhost:$LOCALPORT ssh tunneled/encryptedGRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'kaf500!';MySQL, init wp tableshostnamectlvisudoand append$USER ALL=(ALL) NOPASSWD: ALLffmpeg -i input.mp4 output.mp4 -vcodec libx264 -crf 20(where CFR accepts value from the 0-51 range: 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so)
apt
apt list -a <packagename>apt install <packagename>=<packageversion>
fontconfig
fc-cache -fvrefresh cachefc-match serif,fc-match sans-serif,fc-match monospacecheck default font families
SSH
ssh-copy-id -i $PUBLICKEY $USERNAME@$HOSTssh -t foo@100.100.100.100 ssh remote@123.123.123.123 -p 4000ssh trough ssh tunnelssh -At foo@100.100.100.100 ssh remote@123.123.123.123 -p 4000same but forwarding the Authentication
GPG
Use ECC + ECC (ed25519) with Curve 25519 (cv25519) as elliptic curve.
gpg --list-keyslist keys with key-idsgpg --list-keys --with-fingerprintlist keys in keyring with fingerprints/subkeysgpg --list-kets --format LONGalso show subkeys IDgpg --full-generate-keykey generation wizardgpg --full-generate-key --expertenable more encryption algorithmsgpg --import $FILEimport key (both public/public parts)gpg --edit-key $FINGERPRINT,gpg> trusttrustgpg --armor --export $KEYIDASCII encoded exportgpg --export-secret-keys -a $KEYIDgpg --keyserver http://keys.gnupg.net:11371/ --send-key $KEYID, submit to keyserverwget -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=%cdgit remote set-url --add origin ORIGINorigin push to more than one git repository server at a time- After having merged a branch, to continue working on that branch, syncing with master:
# Checkout the default branch (master or develop)
git checkout master
git pull
# Delete the local branch
git branch -D nomeBranch
# Delete remotely
git push origin --delete nomeBranch
# Recreate it locally
git branch -m 'nomeBranch'
# During the first push, specify the branch to remotely track
git push --set-upstream origin nomeBranch
# Pushing to a remote branch with a different Name
git push origin local-name:remote-name
# Amend and sign a commit (DCO)
git commit --amend --signoff
git push --force-with-lease
configuration
Adding --global applies these settings as default/system wide and not only in current repo.
git config user.email $EMAILgit config user.name $NAMEgit config gpg.program gpgset gpg executablegit config commit.gpgsign trueenable gpg-signing commitsgit config user.signingkey $FULLFINGERPRINTset default gpg key to use when signing commits
Common Locations
~/.local/share/applicationsuser-relative launchers/usr/share/applicationsor/usr/local/share/applicationsglobal launchers~/.local/share/user-places.xbeldolphin bookmarks