Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Mint - adding environment variables permanently [closed]

I was trying to modify the ~/.profile file to add a line to the PATH variable. I added this line:

PATH=$PATH:/home/paul/avatar-gf-1.0-ea/glassfish4/bin/

at the end. I restarted the terminal, but it still did not identify commands in that directory. Does anyone know what I am doing wrong?

like image 397
SalmonKiller Avatar asked Sep 25 '13 19:09

SalmonKiller


People also ask

How do I make environment variables permanent in Linux?

To make permanent changes to the environment variables for all new accounts, go to your /etc/skel files, such as . bashrc , and change the ones that are already there or enter the new ones. When you create new users, these /etc/skel files will be copied to the new user's home directory.

How do I change environment variables in Linux Mint?

How do I set global environment variables in Linux Mint? Set them in /etc/profile . When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile , if that file exists. After reading that file, it looks for ~/.

How do I permanently add a PATH in Linux?

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

Try this in the ~/.pam_environment in your home folder. If it does not exist then create it:

PATH DEFAULT=${PATH}:/home/paul/avatar-gf-1.0-ea/glassfish4/bin/

You will need to log in and out.

like image 137
oceanexplorer Avatar answered Sep 27 '22 18:09

oceanexplorer


Run bash -xl to see which startup files are loaded with your shell. .profile may actually not be read. Otherwise try adding export to your assignment:

export PATH=$PATH:/home/paul/avatar-gf-1.0-ea/glassfish4/bin/

Reference about Bash's startup files: Bash Startup Files

like image 24
konsolebox Avatar answered Sep 27 '22 18:09

konsolebox