Permanent PATH variable

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/bin

    to 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"

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/environment

sample 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"

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