Productivity
Coding
Video and graphics
System and file repair
sudo fsck -f /dev/sdXNsudo apt --fix-broken installsudo dpkg --configure -asudo kill -9 $(pgrep program)
fsck must run on an unmounted partition, never on the active root filesystem while the system is running.
Drivers and hardware
ubuntu-drivers devicessudo ubuntu-drivers autoinstallsudo lshw -short
Network and connectivity
sudo resolvectl flush-cachessudo systemctl restart NetworkManagerping google.com
System information
hostnamectllsb_release -asudo dmidecode -s system-serial-number
Ubuntu Server basics
adduser usernameusermod -aG sudo usernamesudo hostnamectl set-hostname server-namesudo timedatectl set-timezone Europe/Copenhagensudo apt install unattended-upgradessudo dpkg-reconfigure --priority=low unattended-upgrades
Create a sudo user and log in with it first — never keep working as root over SSH once the server is set up.
Server hardening and security
sudo nano /etc/ssh/sshd_config→ setPasswordAuthentication nosudo nano /etc/ssh/sshd_config→ setPermitRootLogin nosudo systemctl restart sshsudo ufw allow OpenSSHsudo ufw enablesudo ufw status verbosesudo apt install fail2bansudo systemctl enable --now fail2ban
Confirm your SSH key still logs you in from a second, separate session before disabling password authentication — locking yourself out of a remote server usually means a rescue console or reinstall.
Advanced tools
sudo apt autoremove && sudo apt cleansudo do-release-upgradejournalctl -p 3 -xbsudo reboot
Application administration
Clear terminal history
cat /dev/null > ~/.bash_history && history -c && exit
Clear APT and Snap caches
sudo apt cleansudo rm -rf /var/cache/apt/archives/*sudo apt updatesudo apt upgradesudo apt full-upgradesnap refreshsudo snap set system refresh.retain=2for pkg in $(snap list --all | awk '/disabled/{print $1, $3}'); do sudo snap remove $pkg; done
