Installing programs using apt or Ubuntu Software in Ubuntu and other Debian derivatives will download and install deb packages from the repositories, along with the dependencies. These deb packages, among others, contain executables, configuration files, and man files. These files are copied to the appropriate locations when a package is installed. The installation might also create data files or directories for the application.
Not all of these files are deleted when you uninstall an application using apt or apt-get using the remove option. The dependent packages are also left intact on your Ubuntu system.
You can use apt to remove program binaries along with the configuration and other files. apt can also uninstall unused dependent packages. However, you must manually delete user-specific configuration and data (dotfiles) in the user's home directory.
Steps to completely remove program in Ubuntu and Debian:
- Launch terminal.
- Search for package name if you dont know the exact name.
$ sudo apt list --installed | grep mariadb WARNING: apt does not have a stable CLI interface. Use with caution in scripts. mariadb-client-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-client-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-common/focal,now 1:10.3.22-1ubuntu1 all [installed,automatic] mariadb-server-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-server-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-server/focal,now 1:10.3.22-1ubuntu1 all [installed]
- Fully remove the program along with config files using apt.
$ sudo apt purge mariadb-server Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: galera-3 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmysqlclient21 libsnappy1v5 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3 mysql-common socat Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: mariadb-server* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 68.6 kB disk space will be freed. Do you want to continue? [Y/n] ##### snipped
- Confirm deletion if asked.
- Completely remove unused dependent packages along with configuration file.
$ sudo apt autoremove --purge Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: galera-3* libcgi-fast-perl* libcgi-pm-perl* libconfig-inifiles-perl* libdbd-mysql-perl* libdbi-perl* libencode-locale-perl* libfcgi-perl* libhtml-parser-perl* libhtml-tagset-perl* libhtml-template-perl* libhttp-date-perl* libhttp-message-perl* libio-html-perl* liblwp-mediatypes-perl* libmysqlclient21* libsnappy1v5* libterm-readkey-perl* libtimedate-perl* liburi-perl* mariadb-client-10.3* mariadb-client-core-10.3* mariadb-common* mariadb-server-10.3* mariadb-server-core-10.3* mysql-common* socat* 0 upgraded, 0 newly installed, 27 to remove and 0 not upgraded. After this operation, 173 MB disk space will be freed. Do you want to continue? [Y/n] ##### snipped
- Check if configuration and data files still exist.
$ sudo ls -l /etc/mysql /var/lib/mysql ls: cannot access '/etc/mysql': No such file or directory ls: cannot access '/var/lib/mysql': No such file or directory
Some program does not properly clean up so the configuration and data files might still exist.

Mohd Shakir Zakaria is a skilled cloud architect with a background in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he helps others understand the complexities of computing, making tech concepts accessible to all.
Comment anonymously. Login not required.