‘apt‘ or the Advanced Packaging Tool is one of the most powerful system tool available in Ubuntu. If you are a GUI lover or a classic terminal junkie, you have to deal with it no matter what. Almost all Ubuntu users have used it knowingly or unknowingly. So, now lets take a walk down the basics of this tool, how it works and how to master it.
sudo apt-get install <package_name>
It downloads and installs the given package if present in the package database. This command will automatically verify package authenticity for gpg keys it knows about.
sudo apt-get -d install <package_name>
Downloads the package file only, places it in /var/cache/apt/archives. No install is done.
sudo apt-get -f install <package_name>
Does a check for broken packages & tries to fix any “unmet dependency” messages.
NOTE : ‘<package_name>’ should be replaced by the actual package name that needs to be installed. If you put <package_name>* then all the packages with the same first name will be installed . This is really helpful if you want to install all the packages starting with the same initial name.
sudo apt-get update
Consults /etc/apt/sources.list and updates the database of available packages. Be sure to run this command whenever sources.list is changed.
sudo apt-get upgrade
Check updates for all installed packages and then prompt to download and install them.
sudo apt-get dist-upgrade
Updates the entire system to a new release, even if it means removing packages.
Note: This is not the preferred method for updating a system.
sudo apt-get autoclean
Should be run once a week to delete partially downloaded packages, or packages no longer installed.
sudo apt-get clean
Removes all cached packages from /var/cache/apt/archives & frees up disk space.
sudo apt-get remove <package_name>
Removes the named package from the system.
sudo apt-get –purge remove <package_name>
Remove the named package and all its configuration files. Remove the –purge keyword to keep config files.
Lists all packages installed on the system.
apt-cache show <package_name>
Displays information about the software from the named package.
Displays version information of installed APT utilities.
sudo apt-key list
List gpg keys that APT knows about. apt-cache stats Print statistics on all packages installed.
apt-cache search <package_name>
Searches for the package by name (case sensitive). The package names and descriptions are returned where that keyword is found.
apt-cache depends <package_name>
Displays dependencies for a package (whether it’s installed or not).
For further information about the use of APT
Lets just consider we need a program named ‘nmap’. We will now see the installation, checking and removal procedure.
First we go and search for ‘namp’ –
apt-cache search nmap
Ok ! Its there so now we just type the command to get the software package –
sudo apt-get install nmap (Remember nmap* will install all the packages starting with the name nmap)
The terminal will ask for password, just type it in and press enter. Nmap will be installed in a few moments depending on your internet speed & thats it !
If you dont want it, you can remove it easily. To remove nmap, just type-
sudo apt-get –purge remove nmap
and it will be done. Thats it for now. We leave you with rest of the commands for experimentation but be careful !
If you still don’t wanna go into these complications try using Ubuntu Tweak or Ailirus