mudia.link logo

How To Install Rust Command Beakdown

Instructions on how to install Rust are found at these following links:

On the Linux machine, the command is quite complex:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I was familiar with the curl command; however, I had look up some of these switches to see what they did.

Here is a breakdown of the install-rust-on-linux command. Enjoy!

curl

curl is a command-line tool for transferring data using various protocols like HTTP, HTTPS, FTP, and more. It allows you to fetch and send data to and from servers, making it useful for downloading files or interacting with web services. In this case we are using curl to download a shell script that installs rust.

--proto

The --proto switch in the curl application specifies the protocol to be used for the transfer, allowing you to explicitly define protocols like HTTP, HTTPS, FTP, and others when making requests to servers.

'=https'

The '=https' indicates that the curl command will specifically use the HTTPS protocol for the data transfer when making requests to servers.

--tlsv1.2

The --tlsv1.2 switch in the curl command enforces the use of the TLS 1.2 protocol for secure communication. It ensures that data transferred between the client and server is encrypted and transmitted securely using this protocol version.

-sSf

The -sSf characters modify the curl download process. "-s" silences most output, "-S" shows errors, and "-f" prevents the display of error pages, ensuring a quiet and uninterrupted download experience without displaying unnecessary information or error pages.

https://sh.rustup.rs

Importantly, https://sh.rustup.rs is the URL to the Rust programming language's installation shell script.

| sh

The "|" (pipe) followed by "sh" takes the output of the previous command (which happens to be the Rust installation script) and runs it using the shell (sh), executing the script directly, and this begins the Rust installation process automatically.

If you look inside the rust installation shell script, you'll find that (as it says itself) the script "is just a little script to install rustup. It just does platform detection, downloads the installer and runs it."

And the best part about all of this, boom!, you have rust on your linux system.