3 ms·
A lot of command-line programs that operate on files take '-' as placeholder for stdin or stdout. For example: wget -O - 'http://news.ycombinator.com' | les
by pyre 16y ago
A lot of command-line programs that operate on files take '-' as placeholder for stdin or stdout. For example:
wget -O - 'http://news.ycombinator.com' | less
The -O option is for specifying an output file, but the '-' says to dump the contents to stdout.
- blaix 16y agoThanks! Always enjoy adding to my command line tool belt.
- pjscott 16y agoFunny; I always use the curl command for that kind of thing, since it automatically pipes to stdout -- but there's something fun you can do with that, too: curl http://example.com/foo.tar.gz | tar zxf - Tar's input file is "-", which means stdin. This downloads and decompresses a tarball to the current directory, without creating a temporary file that I have to delete later.