Sample Header Ad - 728x90

Complete view of where the PATH variable is set in bash

38 votes
6 answers
86486 views
I've read in a couple of places that the PATH is set in /etc/profile or the .profile file that's in the home dir. Are these the only places that the path is set in? I want a better understanding of it. In the /etc/profile file, as the following comment says "system-wide .profile file for the Bourne shell". Does that mean that profile files are the main configuration files for bash? In that file I don't see the PATH var being set at all. In the .profile file in the home directory there's this line: PATH="$HOME/bin:$PATH" That's resetting PATH by the looks because it's concatenating the already set $PATH string with $HOME/bin: right? But if etc/profile and ~/.profile are the only files setting PATH where is $PATH coming from in that line of code if it's not defined in /etc/profile? Can someone experienced please give a broad and detailed explanation of the PATH variable? Thanks!
Asked by Larry Lawless (491 rep)
Sep 7, 2015, 08:04 AM
Last activity: Jul 16, 2025, 12:29 PM