mjl.
← All articles

Linux Packages, Processes, and System Inspection

linuxaptprocessessystem-administration

Package management and system inspection should be deliberate: update metadata, make the smallest required change, and verify the result. Commands below target Debian and Ubuntu systems.

Packages

sudo apt update
apt search nginx
apt show nginx
sudo apt install nginx
sudo apt remove nginx

apt update refreshes package metadata; it does not upgrade installed packages. Do not mix repositories from different distributions or releases. On Fedora, use dnf; on Arch, use pacman.

Hardware and operating system

cat /etc/os-release
uname -a
lsblk -f
free -h
df -hT
lscpu

df reports filesystem capacity, while du helps locate large directories:

sudo du -xhd1 /var | sort -h

Processes and services

ps aux --sort=-%mem | head
top
systemctl status ssh
systemctl is-enabled ssh
journalctl -u ssh --since '1 hour ago'

Stop or restart a service only after identifying its dependants. systemctl enable configures startup; it does not start a service immediately. Use systemctl enable --now service-name when both actions are intended.

Editors and logs

For a small configuration change, nano is approachable. Vim is useful on minimal servers. Always make a backup before changing an unfamiliar service configuration and validate it with the service’s own test command before restarting.

journalctl -p warning..alert -b
dmesg --level=err,warn

Next step

For command composition, archives, and file transfer, read Linux Shell Pipelines, Redirection, and Archives.