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

I've used this command to find the IP of the server. Can someone explain what the command means? I want to learn.

So far I know: "wget" is a free utility for non-interactive download of files from the Web [http://linux.about.com/od/commands/l/blcmdl1_wget.htm]

"-O" Writes the documents to File

"-q" quiet (no output)

But why use that "-" in between?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The "-O -" means it will write the output to standard output (your console). Generally, you can use "-" as a file with many command line tools to send their output to stdout.

share|improve this answer
    
Just to be clear stdout is the command line right? –  user101699 Dec 22 '11 at 0:49
1  
No, stdout is the normal output pathway which, when you launch a program from the shell, is connected to your terminal/console. –  David Schwartz Dec 22 '11 at 1:43
    
STDOUT is a file descriptor that is used by process to send normal messages to the terminal. It can be redirected with a pipe "|" to be the STDIN for another command. –  Mircea Vutcovici Dec 22 '11 at 1:43

Please see the man page for wget, which explains the -O option and the meaning of the hyphen.

-O file

--output-document=file

The documents will not be written to the appropriate files, but all will be concatenated together and written to file. If - is used as file, documents will be printed to standard output, disabling link conversion. (Use ./- to print to a file literally named -.)

share|improve this answer

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.