PATH (all upper case) is the name of an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are searched for.

learn more… | top users | synonyms

110
votes
4answers
185k views

How to correctly add a path to PATH?

I'm wondering where a new path has to be added to PATH environment variable. I know this is accomplished editing .bash_rc (for example), but it's not clear how to do this. This way: export ...
10
votes
6answers
664 views

How can I cleanly add to $PATH?

I'd like a way to add things to $PATH, system-wide or for an individual user, without potentially adding the same path multiple times. One reason to want to do this is so that additions can be made ...
8
votes
1answer
1k views

How to run my own program without specifying its path

Let's suppose I have compiled something and I run it like so: $ /path/to/my/executable/mycmd Hello World What do I need to do to run it like $ mycmd Hello World from everywhere in my computer? ...
18
votes
4answers
833 views

Path independent shebangs

I have a script that I want to be able to run in two machines. These two machines get copies of the script from the same git repository. The script needs to run with the right interpreter (e.g. zsh). ...
22
votes
12answers
3k views

Remove duplicate $PATH entries with awk command

I am trying to write a bash shell function that will allow me to remove duplicate copies of directories from my path environment. I was told that it is possible to achieve this with a one line ...
14
votes
4answers
835 views

keep duplicates out of $PATH on source

I have the following code that's source-d by my .shellrc PATH="${PATH}:${HOME}/perl5/bin" PATH="${PATH}:${HOME}/.bin" export PATH but if I make changes to other code and then source this file, my ...
30
votes
4answers
23k views

What is the 'working directory' when cron executes a job

I have a script that works when I run it from the command line, but when I schedule it with cron I get errors that it cannot find files or commands. My questions is twofold: When I schedule a cron ...
5
votes
2answers
8k views

How to add home directory path to be discovered by Unix which command?

I have installed node.js at custom location and added the location to the $PATH in .profile file. Hoons-MacBook-Air:npm Eonil$ node --version v0.6.2 Hoons-MacBook-Air:npm Eonil$ which node ...
3
votes
6answers
321 views

Will $0 always include the path to the script?

I want to grep the current script so I can print out help and version information from the comments section at the top. I was thinking of something like this: grep '^#h ' -- "$0" | sed -e 's/#h //' ...
1
vote
2answers
415 views

Setting PATH vs. exporting PATH in ~/.bash_profile [duplicate]

What's the difference and which is better to use when customizing my bash profile? Documentation on the export command is scarce, as it's a builtin cmd. Excerpt from version 1 of my ~/.bash_profile: ...
8
votes
3answers
482 views

Running an executable in PATH with the same name as an existing function

Sometimes I define a function that shadows an executable and tweaks its arguments or output. So the function has the same name as the executable, and I need a way how to run the executable from the ...
2
votes
4answers
586 views

Update Linux Path permanently [duplicate]

Possible Duplicate: How do I set a user environment variable? (permanently, not session) How can I permanently modify the PATH variable in Ubuntu? Is it possible to do it without modifying ...
1
vote
2answers
16k views

How to set environment variable JAVA_HOME that will be saved on exit? [duplicate]

Possible Duplicate: How do I set a user environment variable? (permanently, not session) I use Suse. First was installed jdk7, so JAVA_HOME remains like: /usr/java/jdk1.7.0_05/ After I ...
0
votes
2answers
2k views
19
votes
3answers
6k views

Duplicate entries in $PATH a problem?

I source bashrc's of few of my friends. So I end up having duplicate entries in my $PATH variable. I am not sure if that is the problem for commands taking long to start. How does $PATH internally ...
6
votes
3answers
6k views

Where do executables look for shared objects at runtime

The title is pretty explicit. I understand how to define include shared objects at linking/compile time. However I still wonder how do executables look for the shared object (*.so libraries) at ...
5
votes
3answers
3k views

How to make `sudo` preserve $PATH?

I need to run a program installed on /opt/godi/sbin (a custom directory). If I add that directory to my PATH, by adding the following line to my .bashrc file export ...
3
votes
3answers
2k views

Adding to path vs. linking from /bin

Our sys admin installed a software (Maven) on the server, and told everyone to add the "/usr/local/maven/bin/" folder to their path. I think it could be more convenient to just link the few programs ...
9
votes
1answer
1k views

Where have I set my bash PATH?

I want to remove ~/bin from my PATH.  I set it up months ago when Linux (Ubuntu) was very new to me, but I don't know how I added it... Nothing shows up when I search all the files listed below. ...
8
votes
4answers
3k views

Adding paths to PATH using a multi-line syntax

As far as I understand, the usual way to add a path to the PATH environment variable is by concatenating paths separated by the : character. For example, if I want to add three paths to it ...
14
votes
2answers
2k views

Is it safe to add . to my PATH? How come?

I've seen people mention in other answers that it's a bad idea to include the current working directory ('.') in your $PATH environment variable, but haven't been able to find a question specifically ...
8
votes
5answers
3k views

Find a file in the path without “which”?

I am (somehow) able to run a script: $ assemble.sh file ... [output] But which can't find it: $ which assemble.sh which: no assemble.sh in ...
3
votes
1answer
1k views

ps command not giving output in home directory

I am logging into a solaris server, switching to bash, then switching to another user "sruser" and switching to bash. /home/batch/sruser/ is the home directory of the user "sruser". The issue is ps ...
2
votes
1answer
241 views

How is the path to search for 'man' pages set?

I'm puzzled by how the path used for finding man pages is set. The "right thing" seems to happen magically. For example, if change my PATH from ...
2
votes
2answers
995 views

How do you set the path in a non-shell environment (KDE)? [duplicate]

I'd like to override one of the applications set in /usr/bin/. I have created an alternative with the same name in ~/bin/ which in in my PATH (as set both in .bashrc and in .profile). When I start ...
1
vote
0answers
38 views

How do the various configuration files determine MANPATH on Darwin?

On Darwin (12.2.0, OS X 10.8.2, bash 3.2.48(1)) my MANPATH appears to be determined by my PATH rather than by the various configuration files associated with man and the man path, /etc/manpaths, ...
0
votes
2answers
2k views

installed java, but java -version not showing new java

I just installed jdk1.6.0. I have tried multiple ways to set the path variable and make java 1.6 my new running version. And nothing is working. Running centos5 virtual machine. alternatives --config ...
7
votes
3answers
933 views

My `which` command may be wrong (sometimes)?

I've compiled the last emacs version from the source code (v24.2) because the version installed on my machine is (quite) old for me (v21.3). I've done the usual: $configure --prefix=$HOME make make ...
5
votes
1answer
309 views

zsh - fully expand binary path on <tab>

In my current zsh behaviour, hitting tab after typing "sudo" just adds a space. $ sudo ... What I really want is for the tab to fully expand to the path of the binary it is about to execute when I ...
4
votes
4answers
3k views

Running python script from Linux Terminal

I have downloaded this script named, pyAES.py and put it in a folder name codes, inside a Desktop directory of my Linux, According to this example, ...
2
votes
2answers
72 views

How to add new elements to PATH for daemons (or other best practices)?

I want to add some scripts for custom administrative work to a Linux server (Ubuntu 12.04). Ultimately those scripts are callback scripts from at least one daemon (PostgreSQL in my case but that ...
2
votes
4answers
846 views

Bash script to output path to USB flash memory stick

How would I return (output) the path to any USB flash memory stick(s) connected to the local computer using bash (Ubuntu and Linux Mint)? Background: I'm providing users with an automated backup ...
2
votes
4answers
399 views

Add multiple subdirectories under the same parent directory to PATH

I have installed some tools and put it under $HOME/tools/ and each tool has its own /bin directory that contains the executable program. I now have the path to each individual /bin in my $HOME/.bashrc ...
2
votes
1answer
67 views

/etc/paths in OS X and other Unices

Is /etc/paths read by every shell that I run in OS X? For example, if I use zsh, will it parse /etc/path to populate $PATH? What exactly is the sequence that OS X follows to populate $PATH? Does it ...
2
votes
2answers
664 views

Checking if PATH contains $HOME/mydir and adding it if not (all in a script) [duplicate]

Possible Duplicate: keep duplicates out of $PATH on source I am not an expert with Unix scripting. Some of my scripts are located in $HOME/mydir. Unfortunately, they are not accessible from ...
2
votes
2answers
418 views

What could cause which to not show something in the path?

There is an executable in my path that I believe is a perl script. >$scriptname $outputofscript but >which $scriptname which: 0652-141 There is no $scriptname in $path and the path it ...
1
vote
2answers
815 views

$PATH not modified inside LXDE on Raspbian

I have a bin directory in home/pi. This is added to my $PATH when I login (by .profile), but when I go into LXDE and use LXTerminal my bin directory is no longer added to $PATH.
0
votes
1answer
159 views

Adding Postgres bins to PATH: should I `export`? [duplicate]

I'm on a Mac, but this seems like a UNIX/Linux question. I just installed Postgres.app, and the documentation says to add the /bin directory that ships with Postgres.app to your PATH by adding the ...
0
votes
2answers
668 views

.profile in SCO

Where can I find the .profile in my user's logon in SCO? I am needing to edit it, so I can add a PATH to it, so that my PATH loads up in start up. I have to add: echo $PATH ... as I have already ...
-1
votes
1answer
144 views

Commands not found in shell script

I need to execute scp command without using expect command in script. How to use scp with password? I have tried with following code. HOST=lnx1 USERNAME=user PASSWORD=pwd PATH=/sample/data/ FILE=$1 ...