How to Use Advanced Package Tool (APT) in Linux

Linux operating systems have a different approach in dealing with installation of software.Windows installers usually include all the necessary libraries within the .exe file and the installation is super easy with a double click.But, in Linux, we have to install all the dependent packages before installing a software.This system has many advantages but it is a bit confusing for newbies.Manually installing dependencies is a tedious task, but it can be automated using software managers and command line tools like APT.This section will familiarize usage of  APT in Debian based distributions like Ubuntu and Linux Mint.

1.UPDATING LIST OF SOFTWARES

Linux based distributions have repositories containing packages which are supported by the community or the developers.Details of these software are locally saved on our machine. apt update or apt update command downloads the package lists from the repositories to get information on the newest versions of packages and their dependencies.This command will not install any updates.

2. INSTALLING A PACKAGE

Packages can be installed using the apt install command. We can also install many packages at once by listing all their names.APT will automatically fetch and install all required dependencies for the package.It will let you know if there are some errors like missing dependencies.

3. SEARCH FOR A PACKAGE

The search option searches for the given package name and show all the matching packages.

4. UPDATE PACKAGES

Actual update of installed software is done using the apt upgrade command.We can either install all packages or individual packages.An update should always be performed first so that apt knows which new versions of packages are available.

5.REMOVING PACKAGES

Installed software can be removed using the apt remove command.This command will not remove the automatically installed dependencies.

6.CLEAN UNNEEDED INSTALLED PACKAGES

apt remove command will left you with uncleaned dependencies consuming system disk space.This unneeded packages can be removed using the apt autoremove command

7.REMOVE PACKAGES WITH CONFIGURATION FILES

apt remove command will not remove the configuration of the package causing the same configuration on reinstalling the package.For removing package including its configuration,apt purge command can be use.Usage is similar to apt remove.

8.DELETING DOWNLOADED PACKAGES

apt clean command clean clears out the local repository of downloaded package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/ which contains all .deb packages.Disk space can be retrieved by removing these package files.

9.FIND HELP WHILE USING APT

APT contains many more commands for advanced package management.List of all commands including details can be found using the command apt help.

NOTE:apt and apt-get are very similar command line tools.apt-get may be considered as lower-level and “back-end”, and support other APT-based tools.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *