Listing package man page, services, config files and related rpm of a file, in one alias

fileinfo() { RPMQF=$(rpm -qf $1); RPMQL=$(rpm -ql $RPMQF);echo "man page:";whatis $(basename $1); echo "Services:"; echo -e "$RPMQL\n"|grep -P "\.service";echo "Config files:";rpm -qc $RPMQF;echo "Provided by:" $RPMQF; }
Many times I give the same commands in loop to find informations about a file. I use this as an alias to summarize that informations in a single command. Now with variables! :D
Sample Output
$ fileinfo /var/log/sssd
man page:
sssd (8)             - System Security Services Daemon
Config files:
log files:
Provided by: sssd-common-1.12.2-58.el7_1.6.x86_64

What Others Think

OK the information might be useful, but the command? Urgh! You run "rpm -qf" four times and then "rpm -ql" twice. Step 1: Have a think about caching your results Step 2: Edit command to be more 'fu' Step 3: Profit ;-)
flatcap · 336 weeks and 3 days ago
Challenging:) I slightly modified it. To make it really "fu" I should came with something extraordinary.. will think about, should be something! :)
nnsense · 336 weeks and 3 days ago
That's brilliant! Much more efficient :-)
flatcap · 336 weeks and 3 days ago
took me time to read the forum but its actually great. People should know about this more.
Killersmile · 29 weeks and 3 days ago

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? 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.


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: