Portal Home > Knowledgebase > Articles Database > Dash in linux commands
Dash in linux commands
Posted by HTF1, 03-14-2012, 12:27 PM |
Hi,
Can someone explain me what's the purpose of the single dash in the linux commands?
i.e. (red dashes)
cd ~ && wget -O - hxxp://domain.com | tar xzf -
|
Posted by quantumphysics, 03-14-2012, 12:32 PM |
stdout, iirc
you're piping whatever is the url into tar extract
|
Posted by eenvo, 03-14-2012, 01:17 PM |
The "-O -" argument to wget is telling it "output your results to standard output", and the "-" argument to tar is telling it "get your input from standard input". The pipe ("|") is attaching standard output of wget to standard input of tar, so the effect you get is as quantumphysics mentioned, the contents of the URL are fed into tar to be extracted. Usually the URL in this type of example would be a .tar.gz file (though it might not be named that if it is dynamically generated).
If there are additional commands appended with more "&& something-else" after the untar, be careful - you will likely want to verify that what was downloaded was what you expected before you run arbitrary commands, or you might be installing malicious software unknowingly!
|
Add to Favourites Print this Article
Also Read