List all accessed configuration files while executing a program in linux terminal (improved version)

strace 2>&1 <any_executable> |egrep -o "\".*\.conf\""
Last listed files presumably have higher precedency then files listed first, i.e. configuration files in the personal .config directory will be listed last and their config parameters will be more authoritative then default config parameters defined in /etc directory which are usually listed above them. If you replace ".conf" with ".ini" in the command, initial files will be listed instead of config files. If you do not like to list multiple access to the same config file, pipe to "uniq" or "uniq -c" to prefix lines by the number of occurrences
Sample Output
$ # (grep -v fonts = suppressing listing immense number of font configs)

$ strace 2>&1 geany |egrep -o "\".*\.conf\"" | grep -v fonts 

"/home/knoppix5/.config/geany/geany.conf"
"/home/knoppix5/.config/geany/geany.conf"
"/home/knoppix5/.config/geany/geany.conf"
"/etc/nsswitch.conf"
"/usr/share/geany/filetype_extensions.conf"
"/home/knoppix5/.config/geany/filetype_extensions.conf"
"/home/knoppix5/.config/geany/snippets.conf"
"/usr/share/geany/snippets.conf"
"/home/knoppix5/.config/geany/snippets.conf"
"/home/knoppix5/.config/geany/plugins/filebrowser/filebrowser.conf"
"/home/knoppix5/.config/geany/plugins/saveactions/saveactions.conf"
"/home/knoppix5/.config/geany/keybindings.conf"
"/home/knoppix5/.config/geany/keybindings.conf"
"/usr/share/geany/colorschemes/github.conf"
"/home/knoppix5/.config/geany/colorschemes/github.conf"
"/usr/share/geany/colorschemes/github.conf"
"/home/knoppix5/.config/geany/colorschemes/github.conf"
"/home/knoppix5/.config/geany/geany.conf"
"/home/knoppix5/.config/geany/geany.conf"
"/home/knoppix5/.config/geany/plugins/filebrowser/filebrowser.conf"
"/home/knoppix5/.config/geany/plugins/filebrowser/filebrowser.conf"

0
By: knoppix5
2020-07-31 10:57:29

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: