Ask Your Question

The "Right" place to modify $PATH

asked 2015-02-24 01:16:58 -0600

Right now in my .profile I have the line


But ZSH apparently doesn't care about .profile so I keep having to run source ~/.profile which seems like a dumb solution to me. So I'm guessing that .profile is something gnome and gnome-terminal care about but it's not actually a session wide thing - I don't know. I could add it to ZSH's profile but once seems enough. Where should it go?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-02-24 04:06:51 -0600

hedayat gravatar image

.profile is used by some shells like bash and sh (and probably compatible ones like ksh), but not zsh. AFAIK, there are no standard places used by all shells. In Fedora, /etc/profile is sourced by /etc/zprofile which is used by zsh. Therefore, if you want to change systemwide PATH, you can do it in a .sh file inside /etc/profile.d which will be used at least by bash and zsh.

If you want to change it for a specific user, I don't know of any file used by both bash and zsh. What I've done myself is to change such variables inside ~/.profile, and source that file in ~/.zshrc. So, you can enable using ~/.profile for you zsh by adding one line at the end of your ~/.zshrc, like this:

echo "source ~/.profile" >> ~/.zshrc
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-02-24 01:16:58 -0600

Seen: 943 times

Last updated: Feb 24 '15