RTFM function

rtfm() { help $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
RTFMFTW.

41
By: hunterm
2011-01-05 02:53:38

5 Alternatives + Submit Alt

  • This microscript looks up a man page for each word possible, and if the correct page is not found, uses w3m and Google's "I'm feeling lucky" to output a first possible result. This script was made as a result of an idea on a popular Linux forum, where users often send other people to RTFM by saying something like "man backup" or "man ubuntu one". To make this script replace the usual man command, save it as ".man.sh" in your home folder and add the following string to the end of your .bashrc file: alias man='~/.man.sh' Show Sample Output


    9
    /usr/bin/man $* || w3m -dump http://google.com/search?q="$*"\&btnI | less
    d1337r · 2010-10-05 13:51:39 0
  • Some commands have more information on 'info' than in the man pages


    9
    rtfm() { help $@ || info $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    seattlegaucho · 2011-01-05 21:26:51 2
  • Sometimes you don't have man pages only '-h' or '--help'.


    4
    rtfm() { help $@ || $@ -h || $@ --help || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    karol · 2011-01-05 17:36:26 0
  • Simple edit to work for OSX. Now just add this to your ~/.profile and `source ~/.profile`


    1
    rtfm() { help $@ || man $@ || open "http://www.google.com/search?q=$@"; }
    vaporub · 2011-01-26 06:23:42 1
  • Same as the other rtfm's, but using the more correct xdg-open instead of $BROWSER. I can't find a way to open info only if the term exists, so it stays out of my version.


    1
    rtfm() { help $@ || man $@ || xdg-open "http://www.google.com/search?q=$@"; }
    KlfJoat · 2014-04-25 04:17:03 0

What Others Think

That is so beautiful! You could add info $@ in there somewhere, too, perhaps with a conditional so it only loads info pages in the info reader and man pages in man: [[ -f /usr/share/info/$@.info* ]] && info $@
dennisw · 559 weeks ago
If encountered a problem with the help command. It matches patterns not complete commands. Thus if I call `rtfm tr` it shows the help for the `trap` command which is clearly not what I wanted. Any suggestions?
antibus · 334 weeks ago
Oregon is a coastal U.S. state in the Pacific Northwest known for its diverse landscape of forests, mountains, farms and beaches. The city of Portland is famed for its quirky, avant-garde culture and is home to iconic coffee shops, boutiques, farm-to-table restaurants and microbreweries. Highlights include the Native American art in the Portland Art Museum, the Japanese Garden and the Lan Su Chinese Garden. MaxRemind top rank medical billing company USA offers Medical Billing Services in Oregon and medical credentialing services to in all states of USA at lowest rates.
stevematt · 35 weeks ago
Here is the wise update for the experts who are looking for coding help. While sharing the problem they can easily grab the expert’s suggestion to complete their coding classes. Thanks for my perfect words review update please continue sharing.
AngelinaDillingh · 31 weeks and 5 days ago
It is ideal if the edifying toy that is picked plays music, regardless of whether that it isn't the focal explanation for social affair of the toy. Click http://www.colonchecker.com/">homepage for getting more ideas. A melodic toy will not just be fun and attracting for an enthusiastic grown-up to play with, it would show them a ton.
Ahmed74 · 31 weeks and 5 days ago
Other than appearing for three hours dependably, I am also drinking Chocolate milk consistently. Check this http://www.grammarcheckonline.net/">homepage to read more info. Drinking this is enabling me particularly in fulfilling my success targets.
Ahmed74 · 31 weeks and 5 days ago
I'm for each condition more empowered by the cross combination sort base plans since they are routinely expected to cover every single something. Check this homepage for more info. Notwithstanding, building up a genuine base takes a huge load of time.
Ahmed74 · 31 weeks and 5 days ago
I don't feel that the Liquid Force CPR bar is genuine with the Nitro 2. In case you are finding this sort of source. Just have a look preposition finder in a sentence i hope you will like this. The starting late presented Nitro 2 is offering a couple progressed highlights.
Ahmed74 · 28 weeks and 1 day ago
Without getting Cryptography Assignment Help, finishing it would not be reasonable for me since I am incomprehensibly confusing these days. Once visit checker for more info. I'm importance to discover what I need.
Ahmed74 · 28 weeks and 1 day ago
I've been struggling with the RTFM function at the moment. I'll be trying this one. https://www.bedbugsoakland.com
MichaelRose · 23 weeks 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?

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: