Files & directories
Debian 13 keeps /tmp in memory, so it is emptied at every reboot.
Use /var/tmp for temporary files that must survive a restart.
findmnt /tmpShort, practical things every sysadmin, developer and DevOps engineer should know, each with a command to try and a full explanation. A new tip of the day, every day.
Files & directories
Use /var/tmp for temporary files that must survive a restart.
findmnt /tmpFiles & directories
The same goes for /sbin and /lib: everything lives under /usr now.
ls -ld /bin /sbin /libFiles & directories
Admin commands and user commands now live in one directory; old /usr/sbin paths still work.
ls -ld /usr/sbinShell & terminal
Handy when a command fails with "Permission denied".
sudo !!Shell & terminal
Press Ctrl+R again to jump to older matches, Enter to run, Ctrl+G to cancel.
history | grep sshShell & terminal
Perfect for jumping between two directories, like a config folder and a log folder.
cd -Shell & terminal
Or press Alt+. to insert it, so you can see it before running.
cd !$Shell & terminal
Works by default on Ubuntu and Debian, where HISTCONTROL=ignoreboth.
echo $HISTCONTROLShell & terminal
fg brings it back, and jobs lists everything you have paused or sent away.
bgShell & terminal
Add -d to highlight what changed between runs.
watch -d -n 5 df -hDisks & storage
Find such files with lsof +L1, then restart the program or truncate the file instead.
sudo lsof +L1Disks & storage
On a large data disk you can lower it with tune2fs -m and get that space back.
sudo tune2fs -m 1 /dev/sdb1Disks & storage
Check with df -i: every file needs one inode, and millions of tiny files can use them all.
df -iSystem & services
The kernel creates the text when you read the file. Try cat /proc/uptime.
cat /proc/uptimeSystem & services
A quick health check after a reboot or an upgrade.
systemctl --failedSystem & services
The fastest way to find out why a server crashed or rebooted.
journalctl -b -1 -p errSystem & services
List zones with timedatectl list-timezones.
sudo timedatectl set-timezone Asia/KolkataSystem & services
reboot-required.pkgs next to it lists the packages that asked for it.
cat /var/run/reboot-required.pkgsFiles & directories
Without --, rm reads the name as an option and fails.
rm -- -file.txtFiles & directories
Plain cp -r gives the copies new timestamps and makes you the owner.
sudo cp -a /etc/nginx /root/nginx-backupFiles & directories
GNU tar detects the format itself; you only need -z, -J or -j when creating.
tar xf archive.tar.xzSecurity & SSH
With 022 new files are 644 and directories 755; with 002 they are 664 and 775.
umaskNetworking
It replaces netstat, which many distributions no longer install.
sudo ss -tulpnNetworking
A clean replacement for ifconfig, which is no longer installed by default on many systems.
ip -br aNetworking
Great for checking redirects, caching and status codes without downloading the page.
curl -I https://example.comSecurity & SSH
Run it before you step away from an open terminal.
sudo -kSecurity & SSH
No need to close the terminal window. ~? lists the other escape commands.
~.Security & SSH
It creates ~/.ssh with the right permissions and appends your key to authorized_keys.
ssh-copy-id user@serverPackages
To search packages you have not installed yet, use apt-file or dnf provides.
dpkg -S /usr/bin/sshPackages
apt-mark showhold lists held packages; apt-mark unhold releases them.
sudo apt-mark hold nginxKnow a tip worth sharing? Send it to us · Browse the Linux commands cheat sheet