Article Title: Delete the configuration file of the deleted software package in Debian. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Today, I cleaned up the system and used a command line, which may be of reference value to others.
Dpkg-l | grep "^ rc" | awk '{print $2}' | xargs aptitude-y purge
Purpose:
Delete the residual configuration file of the deleted software package. Purge can be cleared only when the remove package in debian does not delete the configuration file, but it is removed automatically based on the dependency. It takes a long time to complete the manual operation, there will inevitably be a lot of unnecessary configuration files left, which is annoying, so the above operations are involved.
Note:
1) dpkg-l
Lists the status of all packages installed in the system. packages starting with 'II' are installed normally, while packages starting with 'rc 'are deleted but still leave the configuration file, in other States, there is an error. Once you execute the command, you can see that the beginning of the output result is described.
2) grep "^ rc"
Extract the information of a package starting with rc, that is, the information of the package that is deleted but still contains the configuration file.
3) awk '{print $2 }'
Print the package names. They are located in the second field of the dpkg-l output result. It is estimated that many people use this command to recognize awk, many users only use awk in this command line. I am one of them.
4) xargs aptitude-y purge
Put the above output, that is, put the package name of the configuration file to be cleared after aptitude-y purge. The purge command will clear the configuration file, the-y parameter will automatically prompt the following aptitude command to answer: this switch is usually dangerous, so do not use it easily in general, but here, if you are sure that the configuration files of these packages are cleared, you can use this switch.