apt
This page serves as a reminder for performing common, simple actions with
apt-get
.
In general you will have to call these as sudo
.
How do I install a package with apt?
You can install a package with apt-get using the following command.
sudo apt-get install <package>
How do I display more information about a package with apt?
You can use the apt-cache
show for more information about a package.
apt-cache show <package>
How can I see the dependencies for a package?
You can use the apt-cache show
command will also list the dependencies for a given
package in addition the other information about the package.
apt-cache show <package>
How do I search for packages with apt?
You can use apt-cache
or dpkg -l
to search for packages.
This command will list the packages that contain the search term in the name or the description.
apt-cache search java
This command will also list the packages that contain the search term in the name or description, and it will also indicate whether the package has been installed or not on your system.
dpkg -l *java*
How do I update a package with apt?
You can update a package using the following command.
apt-get update && apt-get upgrade <package>
You can also update all packages with updates by using this command.
apt-get update && apt-get upgrade
You can also downgrade a package if you need to by installing the specific version of a package that you need.
apt-get install <package>=<version>
Or you can reinstall a package using this command.
sudo apt-get install --reinstall <package>
How do I remove a package with apt?
You can remove a package using either of the following commands.
sudo apt-get remove <package>
If you want to completely remove a package and it’s configuration files, you can use this command.
sudo apt-get install --reinstall packagename
How do I see my installed packages with apt?
You can use the dpkg to see all installed packages.
dpkg -l