How will I make this /media/De Soft/mongodb/bin PATH variable permanent?
Everyone is saying "export PATH=$PATH:media/De\ Soft/mongodb/bin to your ~/.profile, or .bashrc, or .zshenv depending on your shell".
I don't know what is ~/.profile, or .bashrc, or .zshenv. What do they do actually?
How will I add export PATH=$PATH:my/path to my .profile/.bashrc/.zshenv?
I'm using 64 bit Ubuntu 14.04 LTS with default terminal.
3 Answers
They are configuration files. One way:
- Open a terminal window using Ctrl+Alt+T
- Run the command
gedit ~/.profile Add the line
export PATH=$PATH:/media/De\ Soft/mongodb/binto the bottom and save
Log out and log in again
Edit:
A safer way is to use quotes. Doing so is necessary if one or more directories in the original PATH contain spaces. So:
export PATH="$PATH:/media/De Soft/mongodb/bin" 6 To permanently change PATH you need to make changes to /etc/environment file. Make a backup before editing:
sudo cp /etc/environment /etc/environment.bak
sudo nano /etc/environmentsample output:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"Paths are delimited by : so to add a new path say x/y/z this will how our /etc/environment looks like:
PATH="x/y/z:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" 2 Type the following in a terminal window
export PATH=/media/De\ Soft/mongodb/bin:$PATH Close the terminal and restart the computer. The path should include /media/De\ Soft/mongodb/bin when you type this in the terminal:
echo $PATH 4