2

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.

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

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).
1

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

export PATH=$PATH:$HOME
6
  • 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
  • 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
  • I created .bash_profile with the above data you mentioned, but when I ran echo $PATH, my directory is not included. what to do?
    – Srikk
    May 17 '11 at 6:27
0

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

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy