Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.