When uninstalling a program or package in Linux, you have two options, or do it through the program center of your distro, or from a terminal.
To uninstall a program from the command line, you need to know the exact name of the package. And it turns out that sometimes, this gets hard to remember. It may happen that when you want to uninstall a program, you are only uninstalling a package or dependency on it. This post will help you to get a package or program through a terminal with apt-cache y aptitude.
The apt-cache command will allow you to observe a lot of information about the packages stored in the APT database.. We can define this information as a cache, which is temporarily stored once the apt-update command is executed, to update the APT database.
Let's start by checking all the packages installed on your distro. If you run:
apt-cache pkgnames | more
A list will be generated with all the packages available in the system. By placing “| more ”allows you to scroll through the list by line by pressing Enter. In the case of wanting to move up and down with the keyboard or scroll arrows, you can execute
apt-cache pkgnames | less
to exit the list of packages, just press the letter "q".
Knowing part of the name
It's certainly a bit rudimentary to look for a package on a list that seems timeless. For this particular example, we will work by searching for the handbrake-gtk program
In case you know the beginning of the package name you can run:
The command will return a list of all packages whose names begin with the name entered above.
That is, if you only remember "hand", when executing the command, you would have something like this.
Aptitude, performs a search in the APT database, and lists all the packages whose name contains the chunk you defined earlier. For example, if you only remembered "brake", you would get something like this.
In either case, whether you know the start of the program or not, you can always use the aptitude command to locate a package.
Once the package is obtained, you can obtain all the information about it from the terminal. Running:
Show all dependencies of the package. If you want to show more information about the package specifications, such as name, size, dependencies, size once installed and more, you can use the show command by executing.
You can always read the apt-cache manual by running
To check any other utility commands.