Hey i didn't know that since which Ubuntu version because i have done this since 8.04?
Printable View
My understanding is system wide environment variables are actually "supposed" to go in /etc/environment in Ubuntu. User only enviroment variables should go in ~/.pam_environment
see this documentation https://help.ubuntu.com/community/EnvironmentVariables
It's a long story but some variables get reset if they are in the places others have mentioned, I ran into this specifically with a variable related to getting minecraft to work on a 64 bit machine.
That's what I get for skimming, my bad.
1. Create a file custom.sh in the folder /etc/profiled.d with the required commands .
sudo vi /etc/profile.d/custom.sh
In place of vi you can use gedit / nedit or the like
In your case custom.sh will have the following lines:
export NETKIT_HOME=~/netkit
export PATH=$PATH:$NETKIT_HOME/bin
export MANPATH=:$NETKIT_HOME/man
2.Make the file executable
command : chmod +x custom.sh
3.Now these variables are permanently available. To remove them either eit the file or remove the file itself.
4.I use this approach in RHEL and it works flawlessly
Not sure since when exactly, but it's outlined in your ~/.profile file by default:
As mcduck says, you're best off putting the extra paths in .profile if you want them system wide, while just putting them in .bashrc would suffice if you only need them in bash shells.Code:# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
EDIT: Also should point out that if you create ~/bin and want it to become part of your path, all you need to do is to logout and log back on, or simply reload your shell:
Code:source ~/.bashrc