apt is a useful command that stands for Advanced Package Tool and is used for installing, updating, removing, and overall managing deb packages on Ubuntu, Debian, and other Linux-based systems. The apt command is particularly useful as it allows an interactive way for users to update their system with the latest security patches, which makes it a very important Linux command.
In this article, we will take a closer look at the apt commands in Linux, and find out how you can use them even as a complete beginner.
What is apt?
Before we dig deep into the common syntax that apt has to offer, let us first look at what apt command does for you. apt is a free, user-centric software that works with the core libraries in Linux to offer an interactive way of installing and removing software. Where apt excels is the simplified process of handling the installation and removal of software in Linux-based systems. apt automates the entire process by precompiling source code and is considered an “important” priority in all current Debian releases.
Now, the apt command is not the only solution to manage your Linux installations as dpkg commands already exist that too can manage installations. However, the apt command is a more friendly way to find, install, upgrade and remove packages from a Linux-based system.
apt Command Syntax
Below is a common syntax of the apt command
You can manage specific packages by including the name of the package in the command line. The apt command also supports different options to customize the process. Below are examples of some well-known apt arguments.
This command downloads a package only but does not proceed with the installation.
Does not download any new package and instead install packages already installed.
There may be several dependencies when managing packages. The command above tries to fix broken dependencies.
This command shows what the output will be without altering the system.
When you are ever in doubt, pull up the help section, and an array of useful commands will pop up on the screen.
Most Common apt Commands
The apt tool works with several commands which will be difficult to list in this article. However, here are some of the most used apt commands that you will inevitably come across while using a Linux system.
One of the most used commands which is used to get the latest versions of available packages, but not install the updates.
Similar to the update command, the upgrade command downloads and installs packages to the new version.
Upgrade installed packages and remove any pre-installed packages that are no longer necessary.
Installs a specified package.
Remove any specific packages.
Search specific packages when a name is provided in the description.
Useful tips and tricks when using the apt command
Now that we have looked into some common apt commands, let us look at some of the common usages of the apt command.
Upgrade Packages with apt upgrade
We have previously seen an update and upgrade command using which we can install new packages. However, if you want to upgrade specific packages, appending its name at the end is a handy little trick.
The update and upgrade command also prints the output when executed. But you can run these commands in just one step and avoid any confirmation pop-up by appending -y attribute at the end.
List Packages using the apt list
The apt list is a command which is used to print the name and details of all available packages. However, the list can often be extremely big resulting in difficulty navigating between the list. This is where more attributes come in handy. For instance, you can type in
To move through the terminal page one at a time.
The apt command is a useful command which simplifies many of the tedious parts of managing packages in a Linux system. While it is often impossible to list all the things you can do with the apt command, our guide serves as a starting point that will guide you to speed with the apt command. You can learn more about the tips and tricks in Linux by clicking here.