Linux – Can someone explain to me what “wget -O – -q icanhazip.com” mean

centoslinuxwget

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?

Best Answer

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.