Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add directory to path globally on ubuntu server

Tags:

How can I add my own directory to PATH without editing my local profile's .bash_profile or .bashrc?

I need to make the scripts in the directory universally accessible from any user that is logged in.

like image 887
Geuis Avatar asked Oct 08 '10 06:10

Geuis


People also ask

How do I add to global PATH?

To add a path to the PATH environment variableIn the System dialog box, click Advanced system settings. On the Advanced tab of the System Properties dialog box, click Environment Variables. In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.

How do I permanently add PATH in Ubuntu?

Permanently add a directory to $PATHbashrc file of the user you want to change. Use nano or your favorite text editor to open the file, stored in the home directory. At the end of this file, put your new directory that you wish to permanently add to $PATH. Save your changes and exit the file.


2 Answers

You should modify the file /etc/environment.

like image 125
enzotib Avatar answered Sep 19 '22 19:09

enzotib


You could add the following in /etc/bashrc

export PATH="$PATH:/your/directory" 
like image 43
Raghuram Avatar answered Sep 21 '22 19:09

Raghuram