Please explain me what does this command mean:
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
wget
- use wget to download something-qO-
first argument is -q, but what does0-
mean? why does it have dash after it?| sh
- something about pipe, but what exactly?
Yes, I read man wget.
-q
runs wget in quiet mode.sh
is the Bourne shell. There are several shells, of which Bourne is the old standard.Your command above is saying to run
wget
in quiet mode (-q
) and because output (O
) takes-
, instead of providing a file as destination, documents will be printed to standard output, disabling link conversion. Then the use of pipe|
startssh
.The vertical line pipe character before the sh pipes the output from
-O-
(standard output to the terminal) to thesh
command which says to execute the file that was downloaded in the terminal as a program, assuming that the file that was downloaded first has its permissions set to allow executing the file as a program.To set the permissions to allow executing a file as a program: right-click the file, select Properties to open the Properties popup window and in Properties select the Permissions tab,and put a check mark to the left of where it says: Allow executing file as program.
In overall this command will just download the script called install-ubuntu.sh from the given URL and then pass to the pipeline to be as input to the next comand which is sh. Thus this will install and run the script called install-ubuntu.sh in single command.