Linux
Shell and SSH
Section titled “Shell and SSH”SSH client config
Section titled “SSH client config”Config inheritance
Section titled “Config inheritance”First obtained value will be used:
Config:
Host fooUser foot
Host barryIdentityFile ~/.ssh/another
Host bar*User bart
Host barmanUser barmanHostName barman.example.com
Host foo bar*HostName example.com
Host fooIdentityFile ~/.ssh/foo
Host bar*IdentityFile ~/.ssh/%hEffect (OpenSSH 9.x, checked with 9.6p1):
| run | result |
|---|---|
ssh foo |
ssh foot@example.com -i ~/.ssh/foo |
ssh bar |
ssh bart@example.com -i ~/.ssh/example.com |
ssh barman |
ssh bart@barman.example.com -i ~/.ssh/barman.example.com |
ssh barry |
ssh bart@example.com -i ~/.ssh/another -i ~/.ssh/example.com |
ssh barqa |
ssh bart@example.com -i ~/.ssh/example.com |
IdentityFile is an exception: all matching values are added and tried in order. %h is the host name after HostName is applied, not the alias typed on the command line (that is %n).
Source: https://man.openbsd.org/ssh_config
Prevent “Too many authentication failures” error
Section titled “Prevent “Too many authentication failures” error”Use:
Host *IdentitiesOnly yesSource: How to Fix “SSH Too Many Authentication Failures” Error
Check what applies to a host with ssh -G <host>. With IdentitiesOnly yes, set IdentityFile per host, otherwise only the default keys are offered.
Bash profile
Section titled “Bash profile”~/.bash_profile for Debian and Ubuntu, whose stock ~/.profile already loads ~/.bashrc:
# PATH first: .profile below sources .bashrc, which may need these toolsif [[ -d "$HOME/.npm-global/bin" ]]; then PATH="$HOME/.npm-global/bin:$PATH"fiexport PATH
# the leading ":" keeps PHP's default scan directoryexport PHP_INI_SCAN_DIR=":$HOME/.config/php"
if [[ -f "$HOME/.profile" ]]; then source "$HOME/.profile"fiSee Bash startup files. Check the PHP result with php --ini.
npm global packages without sudo
Section titled “npm global packages without sudo”mkdir -p ~/.npm-globalnpm config set prefix "$HOME/.npm-global"Add ~/.npm-global/bin to PATH as in the profile above. The npx cache is in ~/.npm/_npx.
sudo without a password
Section titled “sudo without a password”This removes a safety barrier: any process running as your user can become root.
sudo visudo -f /etc/sudoers.d/90-nopasswdAdd one line with your user name:
<username> ALL=(ALL:ALL) NOPASSWD: ALLFiles in /etc/sudoers.d whose name contains a dot are ignored. Verify with:
sudo -k && sudo -n true && echo OKTo undo: sudo rm /etc/sudoers.d/90-nopasswd.
System and packages
Section titled “System and packages”Find packages (Debian and Ubuntu)
Section titled “Find packages (Debian and Ubuntu)”# which installed package owns a filedpkg -S /usr/bin/ldd
# which package provides a file that is not installed yetsudo apt install apt-file && sudo apt-file updateapt-file search libfoo.so.1Missing shared library
Section titled “Missing shared library”For error while loading shared libraries, list what is missing:
ldd <executable> | grep 'not found'ldd may execute the program; for an untrusted binary use readelf -d <file> | grep NEEDED. Find the package with apt-file search (above). For a 32-bit binary (file <executable> shows ELF 32-bit) run sudo dpkg --add-architecture i386 && sudo apt update, then install the :i386 package.
If the library is installed in a non-standard directory:
ldconfig -p | grep libfoosudo ldconfig # after adding the directory to /etc/ld.so.conf.d/Verify checksums
Section titled “Verify checksums”sha256sum file1 file2 > sha256sums.txtsha256sum --ignore-missing --check sha256sums.txtmd5sum --ignore-missing --check md5sums.txtWith --ignore-missing, the command still fails if none of the listed files exist. MD5 only detects accidental corruption.
Desktop and boot
Section titled “Desktop and boot”Reboot into firmware setup
Section titled “Reboot into firmware setup”Opens the UEFI settings. Works only on a system booted in UEFI mode with firmware that supports it:
sudo systemctl reboot --firmware-setupRemember the last GRUB entry
Section titled “Remember the last GRUB entry”In /etc/default/grub:
GRUB_DEFAULT=savedGRUB_SAVEDEFAULT=trueThen, on Debian, Ubuntu and Mint:
sudo update-grubsudo grub-editenv listGRUB cannot save the choice if /boot is on LVM, RAID, ZFS or LUKS. See Environment block.
Signal tray icon
Section titled “Signal tray icon”signal-desktop --start-in-tray # start hidden in the traysignal-desktop --use-tray-icon # show the window; closing it minimizes to the trayBoth flags override the tray setting saved in the application.
Delayed screen lock
Section titled “Delayed screen lock”X11 only. Locks input after 5 minutes and warns 30 seconds earlier:
sudo apt install xtrlock xautolock libnotify-bin
xautolock -notify 30 -notifier "notify-send -t 25000 LOCK" -time 5 -locker xtrlock &xtrlock does not hide the screen, so it is not a privacy lock.

