Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Environment Variables

Bob Ziroll
Bob Ziroll
4,933 Points

Add to PATH from .bashrc or .profile?

I'm in a developer boot camp right now, and one of the instructors had me add a directory to my PATH under .profile instead of .bashrc. After a little (admittedly quick) research, I found this forum which gives a description of why it is better to add a directory to .profile rather than .bashrc.

Anyway, just thought I'd bring it up and see what people say. I know very little about command line stuff, but maybe this'll start a good discussion or explanation from the Treehouse staff

2 Answers

Brandon A.
Brandon A.
2,595 Points

The reason why your instructor is having you add the directory to your PATH to your .profile is because the .profile is usually what sets up all of your presets immediately after you log in. The .profile will contain things such as your preferred shell, and what directory you want to be in as soon as you start up, and other things. The .bashrc on the other hand, is more for things that are not related to settings once you log in, it's meant more for adding extensions to the terminal. It's also specific to the bash shell, whereas the .profile's configurations can carry on regardless of what shell you are in.

James Barnett
James Barnett
39,199 Points

Looks like your instructor is pretty on point.

further reading

Tagging Jim Hoskins & Tommy Morgan to get their thoughts on this one.