Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm working on a linux client and I need to add my home directory path to $PATH but I was unable to do that. I tried to find .bash_profile file and also .bashrc file but both are missing. Please let me know how to achieve this.

share|improve this question

migrated from stackoverflow.com May 18 '11 at 12:13

This question came from our site for professional and enthusiast programmers.

Just create the files on your own. –  shinkou May 17 '11 at 5:33

4 Answers 4

If those files don't exist, you can simply create them.

share|improve this answer

If a .bashrc file doesn't exist, create one! Try adding one with this in it:

share|improve this answer
Will it affect other users if I do. I want the $PATH name to be modified only for my username. –  Srikk May 17 '11 at 5:35
If the .bashrc file is in your home directory, it should affect only you. –  icktoofay May 17 '11 at 5:36
Thanks for the help. –  Srikk May 17 '11 at 5:42
How can I do this inside a perl script? Like if i want the $PATH to be changed only for that script means?? –  Srikk May 17 '11 at 6:05
@Srikk: Sorry, I'm not familiar enough with Perl to help you with that. You can start a new question if you'd like. –  icktoofay May 17 '11 at 6:18

If .bash_profile doesn't exist in your home directory, you can always create it. To accomplish the goal of adding your home directory to the $PATH environment variable add a line similar to the following:

share|improve this answer

Here is a good article on understanding configuration files: http://www.ibm.com/developerworks/linux/library/l-config/index.html#4

The point is - like everyone else says:

  • If it does not exist - create it.
  • If process does not recognize it - restart the process.
  • If it doesn't work - read the manual, may be that config file are not optional or you putted it into a wrong place (for example root user uses different configs due to home dir of root).
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.