The apt-get utility is a powerful command-line tool for managing packages in Debian and other Debian-based Linux distributions such as Ubuntu. In this guide, we will talk about basic apt-get commands and it's usage.
If you are installing a package with apt-get you need to use the following syntax.
# sudo apt-get install <package> [package2 package3]
Installing packages will also install all required dependencies for the program.
You can update apt package database by using the following command.
# sudo apt-get update
Update command will resynchronize the local database with the latest version. An update should always be performed before an install, upgrade or dist-upgrade.
Before we upgrade packages, make sure to update the local database with apt-get. After the database is updated, Use the following command to upgrade installed packages.
# sudo apt-get upgrade
This will upgrade all installed packages on the server.
To remove a package, you can use the following command:
# sudo apt-get remove <package>
This will remove the package from your system, however, it does not remove any of the package configuration files. You can clear package configuration by using the following command:
# sudo apt-get purge
Great! Now you know the basics of the apt-get tool! :)