Skip to main content
deleted 324 characters in body
Source Link
Murphy
  • 2.7k
  • 1
  • 16
  • 22

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruftfindcruft (now abandoned) for Gentoo.

I think your best chance is to query the last access time by using statfind and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. Bonus points for checking the candidates against the package manager in thea script.

$ stat -c "%x"find /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X"atime /etc/wgetrc 1510491650+7 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruft (now abandoned) for Gentoo.

I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. Bonus points for checking against the package manager in the script.

$ stat -c "%x" /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruft (now abandoned) for Gentoo.

I think your best chance is to find and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. Bonus points for checking the candidates against the package manager in a script.

$ find /etc -atime +7 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

added 291 characters in body
Source Link
Murphy
  • 2.7k
  • 1
  • 16
  • 22

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruft (now abandoned) for Gentoo.

I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. And create a backup before changing anythingBonus points for checking against the package manager in the script.

$ stat -c "%x" /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. And create a backup before changing anything.

$ stat -c "%x" /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file.

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruft (now abandoned) for Gentoo.

I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. Bonus points for checking against the package manager in the script.

$ stat -c "%x" /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

added 105 characters in body
Source Link
Murphy
  • 2.7k
  • 1
  • 16
  • 22

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. And create a backup before changing anything.

$ stat -c "%X""%x" /etc/bash_completion.d/gentoowgetrc 2017-style11-init12 14:00:50.870671892 +0100 1510245549$ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. And create a backup before changing anything.

$ stat -c "%X" /etc/bash_completion.d/gentoo-style-init 1510245549 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. I think your best chance is to query the last access time by using stat and remove the files that haven't been accessed for a longer period. I suggest that you create a script that creates a list of candidates for removal, which you can check before finally deleting. For easy comparison by a script you can use the "seconds since epoch" format. And create a backup before changing anything.

$ stat -c "%x" /etc/wgetrc 2017-11-12 14:00:50.870671892 +0100 $ stat -c "%X" /etc/wgetrc 1510491650 

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount /dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered) 

What's left as an option is to do it manually, guessing the related package by name and content of the file.

Source Link
Murphy
  • 2.7k
  • 1
  • 16
  • 22
Loading