You are not logged in.

#1 2023-08-28 12:01:24

Bydo
Member
Registered: 2020-09-06
Posts: 9

How can I list and remove configuation files?

I know that I can use pacman -R to remove a package without removing its configuration files.

How can I list packages that have been removed but still have configuration files on the system?

Also how can I remove a package's configuration files after the package has already been removed?

Thanks

Last edited by Bydo (2023-08-28 12:02:54)

Offline

#2 2023-08-28 12:06:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: How can I list and remove configuation files?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-08-28 12:39:28

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

I'm not asking about ghost files created by a package after installing it. I'm asking about the configuration files installed as part of a package.

In Arch, to remove a package along with its configuration files, you add -n to pacman -R.

How do I list the packages that have been removed but have residual configuration files remaining, and then remove the files?

In Debian, these configuration files can be identified by using dpkg -l | grep ^rc, and removed using apt purge <package name>.

How do I do this in Arch?

Last edited by Bydo (2023-08-28 12:43:26)

Offline

#4 2023-08-28 12:56:14

mpan
Member
Registered: 2012-08-01
Posts: 1,600
Website

Re: How can I list and remove configuation files?

Then, when using pacreport --unowned-files as the root user, any unowned files will be listed if the associated package is no longer installed (or if any new files have been created).


Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#5 2023-08-28 13:02:02

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

mpan wrote:

Then, when using pacreport --unowned-files as the root user, any unowned files will be listed if the associated package is no longer installed (or if any new files have been created).

So is there an equivalent of Debian's apt purge <package> to remove all configuration files left by packages that have been removed (i.e. pacman -Rn but for packages that have been removed but have left-over configuration files)?

Offline

#6 2023-08-28 13:17:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,104

Re: How can I list and remove configuation files?

You're aware that you can use output of one command as input for another command?

Offline

#7 2023-08-28 13:21:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: How can I list and remove configuation files?

Bydo wrote:

I'm not asking about ghost files created by a package after installing it. I'm asking about the configuration files installed as part of a package.

They're the same thing.  Once a package is removed (without removing it's configuration files) pacman no longer has a record of those files - so they are indistinguishable from other unmanaged files.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2023-08-28 13:30:23

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

Trilby wrote:

Once a package is removed (without removing it's configuration files) pacman no longer has a record of those files.

Debian does: apt purge <package> removes a package's configuration files even when the original package is no longer installed. Is there not an equivalent in Arch? I wouldn't expect such a shortcoming.

Offline

#9 2023-08-28 13:34:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: How can I list and remove configuation files?

EDIT: see the note on ".pacsave" below as that makes this much easier.  Just remove .pacsave files if that's your goal.  However, I doubt this is your real goal and there is really an X-Y question here likely about user created config files.

Last edited by Trilby (2023-08-28 13:37:31)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2023-08-28 13:34:21

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

seth wrote:

You're aware that you can use output of one command as input for another command?

Piping output wholesale won't work, since some unowned files are not from removed packages, and I don't want to remove them. I only want to remove residual files from removed packages.

Offline

#11 2023-08-28 13:34:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,727

Re: How can I list and remove configuation files?

If the config files weren't modified, they were removed with -R. If they were modified, they were saved with a .pacsave extension and pacman notified you about it. That's it, there is no more.

Offline

#12 2023-08-28 13:38:02

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

It looks like I'll have to always to add -n to pacman -R. But this workaround isn't ideal and shouldn't be necessary.

Offline

#13 2023-08-28 13:40:35

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,727

Re: How can I list and remove configuation files?

How is that a workaround? If you always want to remove all config files that you have customized, that's normal.

Forget what you know from apt.

Offline

#14 2023-08-28 13:43:45

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

Scimmia wrote:

If the config files weren't modified, they were removed with -R. If they were modified, they were saved with a .pacsave extension and pacman notified you about it. That's it, there is no more.

It looks like all I have to do it delete all .pacsave files then. Is there a command to remove all .pacsave files, other than find / -name '*pacsave' -delete?

Offline

#15 2023-08-28 13:46:11

Bydo
Member
Registered: 2020-09-06
Posts: 9

Re: How can I list and remove configuation files?

Scimmia wrote:

How is that a workaround? If you always want to remove all config files that you have customized, that's normal.

Forget what you know from apt.

I wasn't aware that pacman -R automatically deletes any original configuration files and renames all altered ones to *.pacsave.

Offline

#16 2023-08-30 22:19:37

othersamo_
Member
From: Braislava
Registered: 2020-10-26
Posts: 161

Re: How can I list and remove configuation files?

Also maybe check ~/.config and ~/.local/share or even dotfiles in your ~.
Many programs create config files in your own home folder.


"Why join the navy if you can be a pirate?"
- Steve Jobs

Offline

Board footer

Powered by FluxBB