Nissan Dookeran wrote:
> What's the equivalent location of the DOS/Win PATH statement?
> I wish to be able to run from command line anywhere in Linux a program
> which is not stored in any of the standard paths. In DOS I would type a
> PATH=%PATH%;c:\whatever\; to add it to my standard path.
> How do you do this in Linux?
Normally, you would set your path in your .bashrc file or .profile.
These files are usually found in the directory you end up in, just after
You can use either
Notice that colons are used to separate directories in a PATH variable,
not semi-colons are in DOS.
If you login and find that the contents of your .bashrc or .profile are
not being picked up, try
I believe .bashrc has precedence over .profile, but don't quote me on this.
If you really need to get to grips with the intricacies of UNIX/Linux
command line, you *need* to get the O'reilly book "UNIX Power Tools". It
explains practically every nuance of the shell you will ever need to
know. It's easy to read, too.
There are lots of little tricks you can do in the shell. For example,
you can put a PATH statement inside a shell script. This ensures that no
matter what the user's external PATH, the shell script will find all the
commands it needs.
Lots of fun stuff. I recommend you print out the man page for bash and
study it. It's full of weird and interesting stuff.
Finally, if you want to ensure that all users on the system get access
to the same PATH, you can set the PATH variable in /etc/bashrc or
/etc/profile. All users normally pull those files into their local
.bashrc or .profile.
To see what other environment variables or shell variables you may have
set, type either
at the $ prompt.
Post-finally, just a note, if you can think of it in DOS, it has been
done in UNIX. Where do you think tree-structured directories came from
in the first place?