0

I installed samtools executables within my bin directory under home directory. Installation works perfectly well. I am using Ubuntu 14.04 version and it has .profile and .bashrc in my home directory which looks like this which I asked in my previous post.

previous post

I want to add my /home/user/bin directory permanently in my PATH so that when I open the terminal, it automatically has samtools in the path. My .profile says to put /home/user/bin in the path but it is not executable.

How can I do it?

I have to run it like this after opening the terminal

. .profile
which samtools
/home/user/bin/samtools

Hope to hear from you guys

Thanks

user3138373
  • 521
  • 2
  • 6
  • 19
  • Hi Ron, I did this in my .bashrc and it worked export PATH=/path/to/dir:$PATH but the post says .bashrc is not the right place to set env variables. Why is that?? – user3138373 Aug 17 '15 at 17:33
  • @user3138373 - Generally (quote): 'If you put your path in `.profile` it will be available to your complete desktop session'. Bash specific, I think the rc file is for the interactive bits, and the `profile` is for setting run time bits such as the path - see also: http://stefaanlippens.net/bashrc_and_others . This mostly explained in `man bash` – Wilf Aug 17 '15 at 18:24
  • 1
    `~/.profile` adds `~/bin` to PATH automatically if it exists. You don't need to do anything. – Gunnar Hjalmarsson Aug 17 '15 at 19:29
  • Hi Gunnar, You are right, .profile adds bin folder the PATH but then why my executable's in that bin folder doesn't get sourced when I open up the terminal?? – user3138373 Aug 17 '15 at 20:05
  • Don't understand what you mean by "sourced" in this context. If you have an executable in your `~/bin` named **samtools**, you can run it from anywhere by the command `samtools`. – Gunnar Hjalmarsson Aug 17 '15 at 20:10
  • Btw, you need to log out and log in again after having created the `~/bin` folder. – Gunnar Hjalmarsson Aug 17 '15 at 20:27
  • This is my .profile file looks like It has this for loop in it # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi So i just made a bin folder in my home directory and place my executables in that bin folder. closed the terminal , opened them again; typed which samtools and nothing is showed. If I do . .profile, then which samtools work. HELP!! – user3138373 Aug 17 '15 at 21:23
  • 1
    Log out from the **session** and log in again. Just closing and reopening the terminal is not sufficient. – Gunnar Hjalmarsson Aug 17 '15 at 22:04
  • @user3138373 how did you install samtools? – Ron Aug 21 '15 at 19:13

0 Answers0