LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What is the PATH? (https://www.linuxquestions.org/questions/linux-newbie-8/what-is-the-path-154819/)

h4dyce 03-07-2004 10:17 PM

What is the PATH?
 
Subject says it all.
Thanks!

watashiwaotaku7 03-07-2004 10:21 PM

PATH is the default "paths" that your shell will look in for a command, it enables you to type mozilla instead of /usr/bin/mozilla because it looks for an executable in your current directory, then starts at the topmost directory specified in PATH of which /usr/bin is a part I'm booted into windows now or else I would give you a list of what directories are in my path but for the most part they consist of /bin /sbin /usr/bin /usr/sbin/ and /opt

michaelk 03-08-2004 03:43 AM

An environment variable
linux is different then windows. The shell does not look in the current directory first. To execute in the current working directory use:
./<executable_name>

To see your path
echo %PATH

hw-tph 03-08-2004 03:51 AM

I'd say echo $PATH works better. ;)

To add a directory to the path, say the bin directory in your home folder, simply type as follows:
export PATH=$PATH:~/bin
The PATH environment variable is a colon-separated list of directories and in the line above we set the $PATH to what it was before, plus the ~/bin directory.

If you want to add a directory for to the path for all users you could put something like this in your /etc/profile:
export PATH=$PATH:/whatever/directory/you/want/to/add:/and/another/one

If you want to just do add it for yourself, add the above line to your ~/.bashrc and make sure ~/.bashrc is sourced (executed) from your ~/.bash_profile.


Håkan


All times are GMT -5. The time now is 12:31 PM.