• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

apt Command Examples in Linux

by admin

Although dpkg is the original installer for Debian-derived distributions, today .deb packages are more commonly managed using APT. APT is a front-end manager to the dpkg system, much like YUM is a front-end manager to the RPM system. Until recently, the common software management tools were implemented as a mix of the apt-get and the apt-cache commands, along with several other variations on the apt-* format. Many Debian-derived distributions now use the more streamlined package manager simply named apt.

The apt command comes with several subcommands for managing packages.

Subcommand Description
install {package name} Install the package.
remove {package name} Uninstall the package, leaving behind its configuration files.
purge {package name} Uninstall the package and remove its configuration files.
show {package name} Report information about the package.
version {package name} Display version information about the package.
update Update APT database of available packages.
upgrade [package name] Upgrade the package, or upgrade all packages if none provided (time-consuming).

Syntax

The syntax of the apt command is:

# apt [options] [subcommand] [package name]

apt Command Examples

1. Update the list of available packages and versions (it’s recommended to run this before other `apt` commands):

# apt update

2. Search for a given package:

# apt search package

3. Show information for a package:

# apt show package

4. Install a package, or update it to the latest available version:

# apt install package

5. Remove a package (using `purge` instead also removes its configuration files):

# apt remove package

6. Upgrade all installed packages to their newest available versions:

# apt upgrade

7. List all packages:

# apt list

8. List installed packages:

# apt list --installed

Filed Under: Linux

Some more articles you might also be interested in …

  1. Linux OS Service ‘iptables’
  2. How to Set CPU Affinity for SYSTEMD Process in CentOS/RHEL 7
  3. vshadowmount: command not found
  4. httpd Command Examples in Linux
  5. ubuntu-drivers: command not found
  6. How to prevent non-root user from creating crontab entry
  7. Understanding linux parted utility
  8. lpr Command Examples in Linux
  9. 10 useful cron examples to schedule jobs in Linux
  10. How to Check whether SELinux is Enabled or Disabled

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright