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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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)
-L option to
-L, --location (HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place...
| 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 what
add does with
add <filename> Add a new key to the list of trusted keys. The key is read from the filename given with the parameter filename or if the filename is - from standard input.
As it mentions,
apt key add that the key file should be read from STDIN, which in this case is what was piped from the
curl command, so, in sum:
Download whatever is at this link, even if it has moved, and add it as a trusted APT repository key.