Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

General Question:

Let's say I'm using a command called bar and want to learn more about the -foo option. (Perhaps the man page didn't talk much about it). How can I search the internet for it?

If I do a google search for bar -foo it will take search for all pages that have bar but do not have foo. If I search for bar "-foo" I seem to get pages that have foo and bar, but not necessarily foo -bar. If I search for just -bar I'll be told that it doesn't match any documents, and if I search for "-bar", I'll be given results as if I'd just searched for bar.

Specific Question:

A different serverfault question reminded me of a comment on Slashdot. The article, which may have been months or years ago, was, IIRC, about unexpected behaviour of command-line options. One of the commentors replied that you should create a file called "-i" in important directories (such as /etc) so that if you ever were in the directory and accidentally typed in rm * it would expand to being rm -i [lots of files here] and prompt you, interactively, if you wanted to delete the files. I'd like to find the post, but have searched to no avail.

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

Svish has the right answer, but if you still need additional info the best way to Google it up is often one of "bar foo", bar-foo or bar.foo

The quoted version may get you the closest match if it's there, but even so it may not be the page with the best info. The other two forms are essentially the same, because Google will ignore the exact character "-" or "." but will often rank pages higher if the words occur together.

The best advice is if your search isn't working try something else. That includes changing from web search to Google Groups search to Blog search, as well as changing up the keywords and how you combine them.

share|improve this answer
add comment

Calling a file -i is a minor inconvience. Calling a file -rf could be a catestrophy.

Most GNU command line programmes understand the -- syntax. That means "I've finished the options, the rest of the command line are files".

You can use it to delete a file that starts with '-'.

eg

rm -- -myfile
share|improve this answer
add comment

i think I would rather search for just the command itself and look for a manual or something. In unix you have the man pages, which usually have a listing of all the arguments. For example

man ls

Also, as noted by Kyle, you have a command called info which gives you more information than the man pages do. I would recommend looking at the man pages first though.

info ls
share|improve this answer
    
+1 on that! The manual if often the best resource. –  dwc May 22 '09 at 20:33
add comment

Sometimes 'info command' will give you more information than the man pages do. If the man page only gives you brief information, maybe you could try including some of the brief description in your search. Also, you might be able to add something like 'tutorial' to the search. Lastly, if you are still confused about that particular option, why not ask here ? :-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.