On Mac OS X, the default
$PATH values are:
What are the default values on Linux?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
There's an easy way to find out:
Or, more directly:
But, if you're just looking for some quick info, Ubuntu typically sets the path to:
For questions like this, you can usually dig up the answer by reading the Bible.
Depending on which Linux your using, it might be different. If you have a login to a linux already, just type 'env' to see your environment variables.
If you want to know how the PATH env variable is getting built, have a look at .bashrc and .bash_profile in your home directory. If more curious, you can also look at /etc/profile, /etc/profile.d/* (if exists) and manual for bash (man bash).
bash will set
PATH to a hard-coded default value if it's not set in the environment:
$ env -i bash -c 'echo $PATH' /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
We can check that this value is indeed hard-coded, and not read from the environment or some file, using the
$ strings /bin/bash | grep /usr/sbin /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
However, I get a different result on my Arch Linux machine:
$ env -i bash -c 'echo $PATH' /usr/local/sbin:/usr/local/bin:/usr/bin
So, it looks like this default is chosen at the time the
bash binary was built, which depends on the Linux distribution in use.