Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to set environment variables in ubuntu

Shulou Source: shulou.com Published: 2022-06-01 17:19:08 11月16日 Update

Ubuntu how to set environmental variables, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

One: for the current terminal:

Enter in the current terminal:

The code is as follows:

Export PATH=$PATH:

However, the above method only applies to the current terminal and is invalid once the current terminal is closed or in another terminal.

Two: for the current user:

There is a .bashrc hidden file in the user's home directory. You can add PATH to this file as follows:

The code is as follows:

Vi / .bashrc

Join:

The code is as follows:

Export PATH=:$PATH

If you want to join multiple paths, just:

The code is as follows:

Export PATH=::. : $PATH

Each path should be separated by a colon.

So that every login will take effect.

Three: for all users:

The code is as follows:

Sudo vi / etc/profile

Join:

The code is as follows:

Export PATH=:$PATH

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Code terminal file user path help variable environment clear lower content colon multiple for this householder article novice method more directory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Docker Microsoft NVidia