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.

link|improve this question
Just create the files on your own. – shinkou May 17 '11 at 5:33
feedback

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

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

4 Answers

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).
link|improve this answer
feedback

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

export PATH=$PATH:$HOME
link|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
show 2 more comments
feedback

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

link|improve this answer
feedback

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:

export PATH=$PATH:$HOME
link|improve this answer
feedback

Your Answer

 
or
required, but never shown