In the next article we are going to take a look at Debfoster. This is one command line utility to keep only essential packages and remove those that are no longer needed. Therefore, we can keep our clean system all time. The Debfoster application is a container program for the apt and dpkg package managers. Maintains a list of installed packages that were explicitly requested.
When we run it for the first time, a list of installed packages will be created and saved in a file called keepers in the directory / var / lib / debfoster /. Debfoster will use this list to detect which packages have been installed just because other packages depended on them. If one of these dependencies changes, this utility will notice and ask us if we want to remove the previous package. In this way, it will help us maintain a clean system with the essential packages that we choose.
Install Debfoster on Ubuntu
Debfoster is available in repositories of our Ubuntu distribution. Therefore, the installation will not be a problem. We will only have to execute the following command in the terminal (Ctrl + Alt + T) to install Debfoster on any Debian-based system:
sudo apt install debfoster
Use Debfoster
Create the list of installed packages
Once installed, we must create the list of installed packages by executing the following command in the same terminal:
sudo debfoster -q
The above command will add currently installed packages to keepers file located in the directory / var / lib / debfoster /. We can edit this file to remove the packages that we no longer want to have installed on our system.
We should not remove important and system-related packages, such as Linux kernel, grub, Ubuntu-base, Ubuntu-desktop, etc. It is also advisable to make a backup of important configuration files that we edit manually.
Remove packages that are not on our list
We can force the utility to remove packages that are not listed in the keepers. To do this, we will execute:
sudo debfoster -f
debfoster will remove all packages that are not available in the keepers file, along with their dependencies. Forcing your system to comply with the database.
After this we can run the following command from time to time or after adding / removing packages. With that we will check for orphaned packages or non-breached dependencies that need to be removed.
sudo debfoster
If you have installed / removed any packages Debfoster will ask you what you want to do. If you are not sure what to do, type H to see the available options.
Viewing packages in the Keepers list
To see the list of packages in the database, we will execute:
debfoster -a
Here is the list of packages on my Ubuntu 16.04 LTS desktop.
Use a different database
By default, the packages installed in the file will be kept / var / lib / debfoster / keepers. If we want to specify a different database (a keepers file, of course) we will use the -k option as it's shown in the following:
debfoster -k /ruta/hacia-el/nuevo/archivo/keepers
View orphaned packages
It is not always necessary to run the "sudo debfoster" command to check for orphaned packages. We can perform this function by adding the -s option:
debfoster -s
In case we have an orphan package, but we consider it necessary and we do not want Debfoster to remove it, we will simply add it to the keepers file.
To do so, edit the file / var / lib / debfoster / keepers with your favorite editor, and add the name of this program.
Add / remove packages
As this utility is a container for the apt-get and dpkg package managers, we can also use it to add or remove packages.
For install a package, we will execute in the terminal (Ctrl + Alt + T):
sudo debfoster screen
Now Debfoster will run apt-get and install the specified package.
For remove a package, we will simply place a minus sign (-) directly after the name of the package:
sudo debfoster screen-
Find dependencies
To list all the packages a package depends on, we will use the -d option:
debfoster -d screen
And to list all the packages in the utility database that depend on the given package, we will use the -e option.
debfoster -e nombre-del-paquete
Debfoster Documentation
To get more details about this utility, we can consult the man pages.
man debfoster
As I think you have seen, Debfoster will help us keep track of what we have installed and remove all unnecessary packages. This is one of those apps that remember to use very carefully. Don't remove important system-related packages like Ubuntu-base, grub, Current Kernel, etc. If you do, you may end up with an unusable system.
Thanks very interesting, I hope it is not like other applications that delete important files
You have to be careful when using it, as you could delete important packages. So take a good look when you want to delete lake from keepers
Is it valid for linux mint?