While installing Heroku CLI there's a command I encountered.
Here is the command:
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
What does it mean and how does it work?
aptcommand line
While installing Heroku CLI there's a command I encountered.
Here is the command:
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
What does it mean and how does it work?
Best Answer
curl
is a utility to download something from a link. By default, it writes to STDOUT (ie prints stuff from the link in the terminal)The
-L
option tocurl
means:The operator
|
is a pipe, which passes the output of the command before it as the STDIN of the command after it.apt-key
is a utility to add trusted keys to apt for repositories. You can see whatadd
does withman apt-key
:As it mentions,
-
tellsapt key add
that the key file should be read from STDIN, which in this case is what was piped from thecurl
command, so, in sum:Download whatever is at this link, even if it has moved, and add it as a trusted APT repository key.