Skip to main content

Command referenceapt

apt command (Linux / bash / sh / zsh)

Linuxbashshzshpackagebeginner

What it does

Search, install, update, and remove packages on Debian-based systems. When people search for the apt command linux packages, they usually want apt's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.

Search, install, update, and remove packages on Debian-based systems.

Syntax

apt [OPTION] COMMAND [PACKAGE...]

Common options

Flag / optionMeaning
updateRefresh package indexes.
install PACKAGEInstall or upgrade a package.
remove PACKAGERemove a package while retaining configuration.
search TERMSearch available package descriptions.
show PACKAGEDisplay package details.

Practical examples

Refresh indexes

sudo apt update

Downloads current repository metadata.

Install Git

sudo apt install git

Installs Git and required dependencies.

Find package

apt search image editor

Searches package names and descriptions.

Common mistakes

  • Running install without refreshing stale package indexes.
  • Confusing `apt remove` with `apt purge`, which also removes packaged configuration.

FAQ

What does apt do in Linux?

Search, install, update, and remove packages on Debian-based systems.

How do I use apt from the terminal?

Start with `apt [OPTION] COMMAND [PACKAGE...]`, then choose only the options needed for the task.

What is a practical apt example?

Try `sudo apt update` — Downloads current repository metadata.

Can I use apt in a shell script?

Yes. apt works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.