Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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

Here is a good article on understanding configuration files:

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

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 those files don't exist, you can simply create them.

share|improve this answer

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

Your Answer


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