Dear unixmen reader,
In this tutorial you will learn about the apt-get command-line tool which is considered the user’s “back-end” to other tools using the APT library for handling packages.
It has many useful options that help the user to update the machine, upgrade, install new software, manage software and remove packages when the user wants.
I use the apt-get command almost all the time to keep my Ubuntu system updated and to make sure it has every tool I need for my tasks. If I want to play a game, install a math program or edit a video the apt-get command-line utility helps me to install the proper package.
The Advanced Packaging Tool (APT) is rapid, very practical, it takes care of package dependencies automatically and also takes care of their configuration files while upgrading.
No need to worry about the dependencies. Get a hot coffee and drink it like a boss while apt-get builds the dependency tree for the package which is going to be installed.
In the old days of Linux and before the apt came to life people had to use. tar.gz and compile the software they wanted to install on their Gnu/Linux machines. But this was very boring and time consuming so when Debian system was created the developers saw it necessary for the system to include a method of managing the packages installed on the machine.apt-get
So they created a system for managing the packages and called it dpkg. But this package manager for Debian based system did not make everybody happy. It can only build, install and remove Debian packages. I am pretty sure you are very familiar with the dpkg tool if you have installed .deb packages in your system.
A fast and efficient package manager that would manage dependencies automatically and take care of their configuration files while upgrading was needed. A new dilemma came for makers of Gnu/Linux.
After alot of hard work, passion and dedication they gave birth to APT, the Advanced Packaging Tool that each of us uses nowadays to manage, install and remove packages.
Learn To Use apt-get Command-Line Tool
The first thing you do after a fresh installation of a Linux distro is installing software. The following command will help you install packages in Ubuntu and other Debian based systems.
sudo apt-get install package-name
If you like to remove a package you can do it with the following command.
sudo apt-get remove package-name
But the apt-get remove command does not delete the package. It only removes it. To delete the package and its configuration file you need to run the following command.
sudo apt-get purge package-name
You can also install a list of packages as a space delimited list. It can easily be done with the following command.
sudo apt-get install package1 package2 package3
A very useful command i apt-cache which can be used to search for a package you are looking for. If you use the apt-get command with a package the does not exist in the default repositories it will give you an error and the specified package will not be installed. So, it is always good to do a search for the package before you run the apt-get install command and install it in your own machine.
Use the following command to search for a package you want to install with the apt-get utility.
sudo apt-cache search package-name
Now that you know how to install and remove packages you need to learn how to get the latest packages in Ubuntu or Debian based machines.
sudo apt-get update
The above command resynchronize the package index files from their sources so you can stay updated with information about new and updated packages.