What is the difference between apt and apt-get?
apt is the newer, friendlier front-end for interactive use, with a progress bar and combined commands such as apt install and apt list. apt-get is the older, stable interface with predictable output, so it is preferred in scripts.
Explain it simply
apt-get and apt-cache are the original tools, and apt is a modern wrapper that merges the most used parts of both into one command with nicer output.
Interactive use: apt install, apt remove, apt search, apt show, apt list --installed. It shows a progress bar and colour.
Scripts: apt-get install -y. Its output format and options are kept stable, while apt warns that its command-line interface "is not stable". If a cron job parses the output, a change in apt could break it.
Most commands behave the same. Small differences: apt can run apt update and apt upgrade hints directly, and apt full-upgrade matches apt-get dist-upgrade.
Under both sits dpkg, the low-level tool that unpacks single .deb files. apt and apt-get handle repositories and dependencies on top of it.
Example
sudo apt install -y nginx # interactive, fine
sudo apt-get install -y nginx # use in scripts and Dockerfiles
apt search "web server" | head -3What to say in the interview
"apt is the user-friendly front-end for daily use; apt-get has a stable interface and is the better choice in scripts and Dockerfiles. Both use dpkg underneath and the same repositories."
Common mistakes
- Parsing apt output in scripts, which is not guaranteed stable.