The apt-cache command is used to manipulate and obtain information from the packages at apt's cache. A list of all the possible options can be found here
The apt-get command is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Basic usage is apt-get install <package_name
[ghost] (~) >>> apt-get install -y jwhois -f
(Removed most output)
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up jwhois (4.0-2) ...
If you want to install the build dependencies for a package you can use: apt-get build-dep package_name
. This command searches the repositories and installs the build dependencies for package_name
.
If the package is not in the repositories it will return an error.
The apt-get remove command is identical to install except that packages are removed instead of installed. Note the removing a package leaves its configuration files in system.
[ghost] (~) >>> apt-get remove samba -y
(Removed most output)
Removing samba ...
nmbd stop/waiting
smbd stop/waiting
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Processing triggers for man-db ...
The apt-get purge command is identical to remove except that packages are removed and purged (any configuration files are deleted too).
[ghost] (~) >>> apt-get purge samba -y
(Removed most output)
The following packages will be REMOVED:
samba*
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 23.4 MB disk space will be freed.
(Reading database ... 52750 files and directories currently installed.)
Removing samba ...
nmbd stop/waiting
smbd stop/waiting
Purging configuration files for samba ...
Removing configuration file /etc/default/samba...
Removing configuration file /etc/default/samba...
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Processing triggers for man-db ...
Search for installable packages on a Debian/Ubuntu system
[gitlab] (~/test) >>> apt-cache search jwhois
jwhois - Improved Caching Whois client
Some additional apt-cache commands are listed below:
### Add a package file to the source cache.
apt-cache add
apt-cache gencaches
apt-cache showpkg
apt-cache stats
apt-cache dump
apt-cache depends
apt-cache pkgnames
For a more thorough guide to apt-get you can visit the following sites:
Ubuntu doc
Apt-get cheat sheet