3

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?

2 Answers 2

6

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.

3
  • Just to be clear stdout is the command line right?
    – user101699
    Dec 22, 2011 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. Dec 22, 2011 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. Dec 22, 2011 at 1:43
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .