9

For some reason I am successful in adding new directories to my $PATH but when I run the commands in the terminal the $PATH doesn't summon them.

I modified the $PATH in the ~/.bashrc file, and added the last directory

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:**/home/aldin/mybin/fasta-35.4.12/bin**"

But when I run the command it says command not found. However when I type the full path of the utility I'm able to run it.

Has anyone experienced this problem before? Do you know what I can do to fix this problem?

2
  • 4
    .bashrc is the wrong file, you should change PATH in .profile. See Alternative to .bashrc. Nonetheless, changing .bashrc should work when you launch applications from that terminal. Are you running a shell other than bash? Is your .bashrc read? Tell us what ps $$ shows in a terminal. If you add the line set -x at the top of .bashrc, what output do you see when you open a terminal? Dec 30, 2012 at 16:41
  • I think that you will get what you want entering export PATH=$PATH:$HOME/aldin/mybin/fasta-35.4.12/bin. I hope that some user confirm or refute this information.
    – Lucio
    Dec 30, 2012 at 16:56

2 Answers 2

5

First, make sure that you're restarting your session. Either by closing the terminal window, or logging completely out and back in.

Next, make sure you have actually modified the PATH with echo $PATH.

If you're not the aldin from the file's path (or even if you are), make sure you have permissions to see that directory and to execute that file.

Finally, make sure the command you are trying to run is actually marked with the execute permission. Something like chmod a+x /home/aldin/mybin/fasta-35.4.12/bin/file.sh should work.

Also, you are trying to modify the PATH in a very dangerous way. Instead try:

PATH="$PATH:$HOME/mybin/fasta-35.4.12/bin/"

NEVER (sometimes I wish there was a "super bold") modify the $PATH the way you are, always reference the current $PATH in there somewhere or you will overwrite, rather than, append to the existing entries in it.

3
  • Gilles is also correct if your not running bash .bashrc won't do much good.
    – coteyr
    Dec 30, 2012 at 16:45
  • Aldo is modifying .bashrc, not .profile, so he doesn't need to log out and back in, only start a new terminal. The permissions on the files are ok, otherwise he woulnd't be able to execute the command with the full path. Dec 30, 2012 at 16:52
  • @Gilles "logging in and out of your session".. may have been poorly phrased, but the point is, a new session is needed, either by closing and opening terminal, running bash by hand, or some other way. I will edit the answer. -- leaving log out and back in instead of assuming X.
    – coteyr
    Dec 30, 2012 at 17:03
0

I was having the same type of problem. I couldn't get bash to accept a library path so that my program could use it. That's when I found out about the linker manager. Linux has a linker manager named ldconfig. I navigated to /etc/ld.so.conf.d as a root user. Then I made a config file in there named something like myLibPaths.conf. I added one library path line to that file: like; /home/userName/lib. You could probably add as many path lines to that file as needed. After that, a configuration command was needed.

Execute ldconfig on the command line. Verify the path addition with ldconfig -v | less or ldconfig -v | grep /home/userName/lib.

&)To delete the paths: rm /etc/ld.so.conf.d/myLibPaths.conf

&)To edit the paths: Edit myLibPaths.conf then run ldconfig again.

I have not experimented with setting a library path using bash any more. I may have been able to set the library path with LD_LIBRARY_PATH=$PATH:$HOME/lib, but the linker manager works just fine. The whole trouble was in getting bash to acknowledge the LD_LIBRARY_PATH. Perhaps Linux doesn't handle libraries in this way at all?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .