Shorter answer.
So are you 100% sure you know what you are doing here even if the command works? Because to my eyes, adding a directory on the user’s Desktop permanently to the system PATH seems a bit off to me. Stuff like this should just be installed as a system-wide install using sudo make install
after the source code is compiled.
That said, here is my breakdown on what you are attempting to do, why it’s not working, what can be done to remedy it and past that—like I just said—why this is not a great idea.
Longer answer.
First, this command won’t do anything:
export PATH=$PATH:home/cmccabe/Desktop/NGS/samtools-1.2 >> .bashrc
It mixes up a few concepts incorrectly.
- First, if you start the command with
export PATH=
and all that will do is assign a new PATH
value.
- Next, the path you are adding is incorrect:
home/cmccabe/Desktop/NGS/samtools-1.2
. If anything it should be /home/cmccabe/Desktop/NGS/samtools-1.2
; note the leading slash in front of that path.
- Finally the
>> .bashrc
is somewhat correct but what happens before it is so incorrect it doesn’t matter. The >>
tells Bash to append what preceded it to .bashrc
. And since first command is export PATH=
, that doesn’t output anything. So all that gets appended to .bashrc
is an empty line. And the .bashrc
should be your user’s home directory so be sure to prepend the ~/
to the name like this: ~/.bashrc
.
The real command if this is what you wanted the command to be would be something like this; but please don’t run it:
echo export PATH=$PATH:/home/cmccabe/Desktop/NGS/samtools-1.2 >> ~/.bashrc
The key here is echo
which would just print whatever follows it—without acting on it—into .bashrc
. And then you would run source ~/.bashrc
and if you run an echo $PATH
it should be all set.
All that said, this doesn’t seem like a great idea.
This is your system so do with it as you wish. But looking at what samtools-1.2
is, that’s just source code for the program. If you compiled it then maybe that PATH setting of /home/cmccabe/Desktop/NGS/samtools-1.2
would make sense. But even then the best way to deal with binaries is to actually install them on the system via sudo make install
which would place all related files in the correct places and then just install the samtools
binary into /usr/local/bin
which should already be a part of your PATH.
That said, if you simply did a basic compile of samtools-1.2
and wanted to test it out, then setting it to point to a directory on your user’s desktop makes sense. But past any of that, your question is about permanently adding a program to your path. And in that case I would never recommend you ever permanently add a directory on a user’s desktop to your PATH. The risk of losing something sitting on your desktop is just too great.