How to Install Rust on Linux

Adnan Mujic

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

For more than five consecutive years, the Rust language has been receiving the top spots in all kinds of programming languages’ ratings. Despite the steep learning curve, developers intentionally decide to master this language, as the multiple Rust benefits are definitely worth the effort. In the Rust survey, 27 percent of the respondents (9354 developers) claimed that they often struggle with writing production-ready Rust code. On the contrary, the Go language is known to be much simpler than Rust. Read Yalantis’s blog post, comparing Rust and Go to find out why the simplicity of the language isn’t that important.


To try your skills in the Rust language and build your first projects in it, you’ll need to know how to install Rust. This article is a quick tutorial on installing Rust on the operating system Linux directly via the terminal.

But let’s first discuss the relationships between Rust and Linux, as they’re one of a kind. The Rust language seeped into the core of the Linux operating system to help it run even better.

How Rust is enhancing Linux

The Rust language is phenomenal by all means due to its undeniable characteristics like the highest possible now memory-safety. That’s why Linus Torvalds, the creator of Linux and once an advocate of the C language only, agreed on using Rust for the Linux kernel. The kernel is the core of the whole system, which is in charge of memory and CPU. Here’s an official Linus announcement in December 2022 of the latest release of the Linux kernel with the experimental support of the Rust language.

The main reason why the Linux team decided to give Rust a try is that they needed the solution for constant memory vulnerabilities that appear because of the C language. With Rust, the company can focus on improving other parts of the operating system rather than dealing with memory bugs all the time. Actually, rust use cases are numerous but the Linux kernel is one of the brightest.

After such an inspirational manifestation of the Rust language, which probably should convince you even more that it’s the language of the future, let’s cover how to make Rust available on Linux.

6 quick steps to install Rust on Linux


To begin with the installation, you should open the Linux terminal. Here are the next steps you’ll have to take to make available the Rust server on Linux:

Step 1. Install the curl command by inserting in your terminal the following:

$ sudo apt install curl

Step 2. Next, you can download and install Rust with the help of this command:

$ curl –proto ‘=https’ –tlsv1.2 -sSf

Step 3. Once Rust is downloaded, the installer will ask you whether you want to proceed, you should agree to this request.

Step 4. Next, install the bin directory for cargo (Rust’s package manager), using this command:

$ source $HOME/.cargo/env

Step 5. Then, you need to ensure your user shell (a program that accepts and interprets commands) will properly work with the Rust environment. Do this with the help of the command:

$ source ~/.profile

Step 6. Install dependencies necessary for Rust:

$ sudo apt-get install build-essential -y

After that, you can test Rust and see if it’s up and running and ready for your first projects.

For the timely Rust language update in the future, make use of this command:

$ rustup update

In case you’ll need to uninstall Rust, there is a command for that too:

$ rustup self uninstall

To give you even more value in this article rather than just Rust installation steps, we’d like to discuss in the next section how you can build your first Rust project.

Building your first Rust project


Cargo is your ultimate tool to initiate a new Rust project on Linux. You can create a project, by typing in the terminal a simple command:

$ cargo new {project_name}

This command should launch a new directory with the name you’ve inserted in the {project name}. In this directory, cargo will add all the corresponding files.

After that, you can type:

$ cargo build

This command will initiate Rust’s compiler rustc, which will build your project, using the data from the files in your project directory. To run the project, use the command:

$ cargo run

This was a simplified explanation of how to create a project in Rust on Linux. In the real world, it may be much more intricate, of course. But we hope that you, at least, grasped the concept. In the final section of the article, we’d like to discuss a few Rust tools that can simplify your life when working in the Linux terminal.

Best Rust tools for Linux terminal

Here are a few tools to use in the Linux terminal when working with Rust:

  • It’s a command tool that has a proper color system to differentiate between file types and metadata. Exa is a much better alternative to the common Is command.
  • Starship prompt is a customization tool for efficient shell management. It has support for most of the shells and works fast.
  • Dust is a Rust alternative to du It’s an easy-to-understand solution to get instant updates on the directories that take up disk space.
  • Fd is an excellent tool with short syntax to look for diverse entries in the filesystem.
  • Bottom is a graphical system that provides graphical visualizations of CPU and RAM usage, battery usage, and disk capacity.
  • Tokei displays code statistics. It’s extremely fast and can count millions of code lines in seconds.

There are definitely more tools out there, proving that using Rust on Linux is getting more widespread and the Rust ecosystem is constantly enhancing.

Rust has a lot going for it that other languages don’t. The community is great, the documentation is comprehensive, and the language itself boasts lots of benefits. There is a lot of work yet to be done in terms of improving Rust’s overall user experience, but that just makes it all the more exciting to see what the future holds.

Now that you’ve set up Rust on your system, you’re ready to dive in. You should also definitely read the official Rust book. It’s a great place to start learning. In case you’ll have any issues while working with Rust, you can always become a part of the global Rust community or consider joining some local forums to always get timely help when you need it.