AKGuidebooks Home Server Admin

Linux commands

Software and users#

Installing and updating (apt)#

Command Does
sudo apt update Refresh the list of available software (changes nothing)
apt list --upgradable What could be updated
sudo apt upgrade Install the updates
sudo apt install NAME Install a program
sudo apt remove NAME Uninstall it (keeps its settings)
sudo apt purge NAME Uninstall it and its settings
sudo apt autoremove Remove leftovers nobody needs
apt search WORD Find a package
apt show NAME Details of a package
dpkg -l | grep NAME Is it installed, which version?
command -v NAME Where a command lives (empty = not installed)
ls /var/run/reboot-required Exists = an update needs a restart

Could not get lock

Automatic updates are running. Wait a few minutes. Don't delete lock files.

Accounts#

Command Does
whoami / id You, and your groups
getent passwd All accounts (most are system accounts)
getent group sudo Who is an administrator
sudo adduser NAME New normal user (asks for a password)
sudo adduser --system --group --no-create-home --shell /usr/sbin/nologin NAME New locked service account (like ai)
sudo usermod -aG sudo NAME Make someone an administrator (-aG = add to group; without a it replaces all groups)
sudo usermod -aG GROUP NAME Add to any group (log out and in to take effect)
sudo gpasswd -d NAME GROUP Remove from a group
passwd Change your own password
sudo passwd -l NAME Lock an account's password
sudo deluser NAME Delete an account (keeps their files)

Samba (file sharing) accounts#

Command Does
sudo smbpasswd -a NAME Give a user a file-sharing password
sudo pdbedit -L List file-sharing users
sudo smbpasswd -x NAME Remove a user from file sharing
testparm -s Check /etc/samba/smb.conf for mistakes

Time and restarts#

Command Does
date Current date and time
timedatectl Time zone and whether the clock is synchronised
sudo reboot Restart
sudo poweroff Shut down (someone must press the power button to start it again)
sudo shutdown -r +10 Restart in 10 minutes (sudo shutdown -c cancels)
Made by Anish · 2026