there are packages that could be removed. To remove packages that are no longer
needed, you use
apt autoremove
.
All of this assumes that you know what you are looking for. You may not be entirely
sure of a package name. In that case, you can use
apt-cache
to search for packages.
You can use search terms that may be partial names of packages, since sometimes
packages may not be named quite what you expect. Different Linux distributions may
name a package with a different name. As an example, as you can see in
Example 1-8
,
I have searched for
sshd
because the package name may be
sshd
,
ssh
, or something else
altogether. You can see the results.
Example 1-8. Searching for packages using apt-cache
root@rosebud:~# apt-cache search sshd
fail2ban - ban hosts that cause multiple authentication errors
libconfig-model-cursesui-perl - curses interface to edit config data through
Config::Model
libconfig-model-openssh-perl - configuration editor for OpenSsh
libconfig-model-tkui-perl - Tk GUI to edit config data through Config::Model
openssh-server - secure shell (SSH) server, for secure access from remote machines
What you can see is that the SSH server on Kali appears to be named
openssh-server
.
If that package weren’t installed but you wanted it, you would use the package name
openssh-server
to install it. This sort of assumes that you know what packages are
installed on your system. With thousands of software packages installed, it’s unlikely
you would know everything that’s already in place. If you want to know what software
is installed, you can use the program
dpkg
, which can also be used to install software
that isn’t in the remote repository but you have located a
.deb
file, which is a Debian
package file. To get the list of all the software packages installed, you use
dpkg --list
.
This is the same as using
dpkg -l
. Both will give you a list of all the software installed.
The list you get back will provide the package name as well as a description of the
package and the version number that’s installed. You will also get the CPU architec‐
ture that the package was built to. If you have a 64-bit CPU and have installed the 64-
bit version of Kali, you will likely see that most packages have the architecture set as
amd64
, though you may also see some flagged as
all
, which may just mean that no
executables are in the package. Any documentation package would be for all architec‐
tures, as an example.
Another place you can use
dpkg
is installing software you find that isn’t in the Kali
repository. If you find a
.deb
file, you can download it and then use
dpkg -i
name>
to install it. You may also want to remove a package that has been installed.
While you can use
apt
for that, you can also use
dpkg
, especially if the package was
installed that way. To remove a package by using dpkg, you use
dpkg -r