Learn how the apt command keeps Debian and Ubuntu systems up to date, installs packages and frees disk space. 18.02.2026 | reading time: 3 min You have a fresh Debian or Ubuntu server and need software fast; apt is the tool that makes package management predictable and scriptable. Install a tool in three steps Case: the server needs a quick system monitor. Run the index refresh and install commands. ```bash sudo apt update sudo apt install -y htop ``` A condensed typical response looks like the following: ```console Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: htop 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Fetched 100 kB in 0s (500 kB/s) Selecting previously unselected package htop. Unpacking htop (2.2.0-1)... Setting up htop (2.2.0-1)... ``` Now run `htop` to verify the tool works. Beyond install: keep system healthy Check what will change before you act with `apt list --upgradable` and simulate operations with `apt -s`; upgrade safely using `sudo apt upgrade` and resolve removals with `sudo apt autoremove`; pin a package with `apt-mark hold` to prevent upgrades; and reclaim disk space with `sudo apt autoclean` and `sudo apt clean`. When apt meets lower-level tools apt is a user-friendly front end for the dpkg system: use `apt` for everyday tasks, `dpkg -i` for local .deb installs, `apt-cache` or `apt show` to inspect metadata, and `apt-get` for legacy scripts that require stable behavior; aptitude is an interactive alternative for humans who want a text UI. Practical habits for reliability Always start with `sudo apt update` on a new shell, add `-y` only in trusted automation, run upgrades regularly or via a scheduled job, and test major distribution upgrades in a disposable VM or container before touching production. Clear finish and next steps apt is simple to start with and deep enough to require practice; master the common commands, then explore automation and package pinning to gain confidence; consider formalizing that skill with CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy to turn hands-on know-how into certification. Join Bits & Bytes Academy First class LINUX exam preparation. utilities setup infrastructure scripting troubleshooting