Skip to main content

Package management utility for Debian based distributions. Recommended replacement for apt-get when used interactively in Ubuntu versions 16.04 and later.

# To update the list of available packages and versions (it's recommended to run this before other 'apt' commands):
sudo apt update

# To search for a given package:
apt search <package>

# To show information for a package:
apt show <package>

# To install a package, or update it to the latest available version:
sudo apt install <package>

# To remove a package (using 'purge' instead also removes its configuration files):
sudo apt remove <package>

# To upgrade all installed packages to their newest available versions:
sudo apt upgrade

# To list all packages:
apt list

# To list installed packages:
apt list --installed

# ---

##
# The Ultimate One-Liner
##

# To fully upgrade your system, resolve complex dependency changes, and fsweep away leftover junk files in a single stroke:
sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt clean

# To use as an command alias called 'update':
alias update='sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt clean'

# To write the 'update' alias to '~/.bash_aliases':
echo "alias update='sudo apt update && sudo apt full-upgrade \"-y\" && sudo apt autoremove \"-y\" && sudo apt clean'" >> ~/.bash_aliases

# To write the 'update' alias to '~/.bash_aliases' with a short description:
echo -e "\n# Fully upgrade system, resolve dependencies, and sweep away junk files:\nalias update='sudo apt update && sudo apt full-upgrade \"-y\" && sudo apt autoremove \"-y\" && sudo apt clean'" >> ~/.bash_aliases