Questions tagged [path]

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.

The PATH(all upper case) is an environment variable in the UNIX and Linux(and many other) operating systems. It contains colon delimited list of directories, where the shell searches through when a command is executed. The executables are stored in different directories in the UNIX and Linux operating systems.

Examples

Simple way to show the $PATH variable is:

echo "$PATH"
printf "%s\n" "$PATH"

A typical PATH looks like:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Further reading

1002 questions
57
votes
4 answers

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 addressing the issue. So, why shouldn't I add .…
Jander
  • 16,682
57
votes
7 answers

How can I set all subdirectories of a directory into $PATH?

It looks like when adding a directory into $PATH, its subdirectories are not added recursively. So can I do that? Or is there a reason why this is not supported?
Tim
  • 101,790
45
votes
4 answers

`which`, but all

I think most are familiar with the which command, and I use it frequently. I just ran into a situation where I'm curious not just which command is first in my path, but how many and where all the commands in all my paths are. I tried the which man…
kenny
  • 1,453
39
votes
2 answers

What is the difference between PATH and LD_LIBRARY_PATH?

I am having some difficulties understanding the difference between PATH and LD_LIBRARY_PATH. I have an installation setup that needs a file pkg.tcl and I am not where to add the path to it: should it be to PATH or LD_LIBRARY_PATH?
cindy
  • 461
16
votes
1 answer

Is it possible to add a single executable, rather than an entire directory, to my $PATH?

I have XAMPP installed in OSX, and by default it prepends the path to its own bin directory (full of various utilities) to my $PATH variable: # Add path to XAMPP PHP version export XAMPP_PHP=/Applications/XAMPP/xamppfiles/bin export…
alexw
  • 263
9
votes
1 answer

Why isn't the first executable in my $PATH being used?

I have a script called jsl in /usr/local/bin. Running which jsl finds it there. I want to temporarily use a different version, and when I echo $PATH I see that /usr/bin is earlier in the path. So I added a script called jsl in that folder and I've…
Nathan Long
  • 1,623
6
votes
5 answers

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 file like this: export…
5
votes
3 answers

SSH call does not see correct $path which exists on a server

On Ubuntu 14.04 I try to establish Drush through Composer. I added PATH="~/.composer/vendor/bin:$PATH to either .bashrc or .bash_profile on a server. Drush is invoked properly on the server. But it does not properly for remotely: ssh myalias…
Artu
  • 63
4
votes
1 answer

difference between /var/www and /usr/local

I don't understand the difference between /var/www path and /usr/local path on linux command because for instance at the moment I can see my red5 server folder is in the latter path and within that folder is /webapps/root/demos path and has me…
cea
  • 1,543
3
votes
1 answer

What is the correct way to add single user binaries to $PATH?

like most folks, I'm occasionally installing things or writing/using scripts that are sourced from outside my distros repositories or "handmade", so they might not end up in the systems default path, or should not be added to that. Now there is…
JC_CL
  • 179
2
votes
5 answers

I don't see .bashrc in my home directory but want to make a permanent change to my path

I am trying to add a location to my $PATH variable on a Mac running OS X. I am following this tutorial, which says to edit the .bashrc file. I don't see this file in the home directory even when I do cd ~/ ls -A Can I just go ahead and create…
bernie2436
  • 6,655
2
votes
1 answer

How do I shadow an executable in $PATH?

I have 2 different versions of pipenvs in my $PATH: $ where pipenv /usr/local/Caskroom/miniconda/base/bin/pipenv #1 /usr/local/bin/pipenv #2 and I want to shadow pipenv #1 so that #2 can take precedence, while keeping…
Teddy C
  • 457
2
votes
1 answer

Linux /etc/profile.d/myscript.sh did not run using VNC

I have a script in /etc/profile.d/setpath.sh #!/bin/sh export PATH=$PATH:/sbin The script is doing simple thing but it does not set my path environment when I use vnc. (Open terminal in vnc) I read up some information on login shell and non login…
Allen W
  • 31
2
votes
0 answers

How do I permanently add to $PATH for all users?

I made a directory /opt. How can I add it to the path for all users? I tried adding it to /etc/profile but it didn't work. # /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1),…
Michael
  • 160
2
votes
2 answers

Amazon Linux - update path to java

I downloaded a fuller version of java, and I wanted to update the default path to java. I tried updating the bashrc file as they did here http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/ , but that did not work. How do I fix…
1
2 3 4