Questions tagged [path]

The general form of a file or directory name that specifies a unique location in a file system. In many Linux and Unix-like OS the PATH (all upper case) variable specifies the directories where executable programs are searched for.

A path represents a unique file system location using the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly a slash /, a backslash \, or a colon :.

A PATH (all upper case, ) in the Linux, UNIX-like operating systems and Windows contains list of directories, where the shell searches through, when a command is executed. The executables are stored in different directories in the OS. On UNIX-like OS the directories are separated by colon, on Windows by semi-colon.

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

More generally, a path is a sequence of directions that, when followed in order, reach a certain object or location.

In addition to file system paths, there are paths through a tree:

root->left->right->right->left

or, again more generally, a set of attributes on an object.


There might be some other contexts where the term "path" is used to described something non-URI and non-directory related which are not covered by the general description.

One case would be in a context such as in the SCADA software, Ignition, where the term "path" is generally used to refer to tag-path - as Tag is the basic unit in the software, forming a hierarchical system like directory. Typical tag-path in Ignition look like this:

BaseFolder/MyTag

Or, more complexly when tag is not in the BaseFolder but referred from another "Parent" Tag:

BaseFolder/MyAdvanceUDTTag/MyBaseUDTTag/MyTag
19410 questions
303
votes
13 answers

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

I'm having xcode issues when I try to use brew and git: xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for…
devB78
  • 11,894
  • 3
  • 14
  • 14
300
votes
31 answers

Determine path of the executing script

I have a script called foo.R that includes another script other.R, which is in the same directory: #!/usr/bin/env Rscript message("Hello") source("other.R") But I want R to find that other.R no matter what the current working directory. In other…
Frank
  • 64,140
  • 93
  • 237
  • 324
295
votes
18 answers

Why does sudo change the PATH?

This is the PATH variable without sudo: $ echo 'echo $PATH' | sh /opt/local/ruby/bin:/usr/bin:/bin This is the PATH variable with sudo: $ echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin As…
Michiel de Mare
  • 41,982
  • 29
  • 103
  • 134
294
votes
6 answers

javac is not recognized as an internal or external command, operable program or batch file

I am experiencing an error while trying to compile Java programs. I am on Windows (this is a Windows-specific problem) and I have the latest JDK installed. I have attempted a solution involving the PATH variable, but the error persists. Console…
user987137
  • 2,957
  • 3
  • 14
  • 3
286
votes
35 answers

Eclipse - no Java (JRE) / (JDK) ... no virtual machine

I am trying to get Eclipse v3.5 (Galileo) to re-run on my computer - I have run it before with no problems, but now I keep getting this error: A Java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse.…
Wallter
  • 4,275
  • 6
  • 29
  • 33
281
votes
5 answers

Create whole path automatically when writing to a new file

I want to write a new file with the FileWriter. I use it like this: FileWriter newJsp = new FileWriter("C:\\user\Desktop\dir1\dir2\filename.txt"); Now dir1 and dir2 currently don't exist. I want Java to create them automatically if they aren't…
user321068
280
votes
11 answers

How do I edit $PATH (.bash_profile) on OS X?

I am trying to edit an entry to PATH, as I did something wrong. I am using Mac OS X v10.10.3 (Yosemite) I have tried: touch ~/.bash_profile; open ~/.bash_profile But the file editor opens with nothing inside. My problem: I am trying to install…
Thiago
  • 12,778
  • 14
  • 93
  • 110
273
votes
22 answers

How to place the ~/.composer/vendor/bin directory in your PATH?

I'm on Ubuntu 14.04 and I've been trying all possible methods to install Laravel to no avail. Error messages everything I try. I'm now trying the first method in the quickstart documentation, that is, via Laravel Installer, but it says to "Make sure…
which1ispink
  • 3,018
  • 3
  • 14
  • 24
271
votes
5 answers

How should I write a Windows path in a Python string literal?

Suppose I need to refer to the path C:\meshes\as. If I try writing that directly, like "C:\meshes\as", I encounter problems - either some exception, or the path just doesn't work. Is this because \ is acting as an escape character? How should I…
Gareth
  • 3,502
  • 4
  • 20
  • 21
266
votes
14 answers

Get absolute path of initially run script

I have searched high and low and get a lot of different solutions and variables containing info to get the absolute path. But they seem to work under some conditions and not under others. Is there one silver bullet way to get the absolute path of…
inquam
  • 12,664
  • 15
  • 61
  • 101
257
votes
13 answers

How to create multiple output paths in Webpack config

Does anyone know how to create multiple output paths in a webpack.config.js file? I'm using bootstrap-sass which comes with a few different font files, etc. For webpack to process these i've included file-loader which is working correctly, however…
spb
  • 4,049
  • 6
  • 22
  • 30
256
votes
6 answers

Get full path without filename from path that includes filename

Is there anything built into System.IO.Path that gives me just the filepath? For example, if I have a string @"c:\webserver\public\myCompany\configs\promo.xml", is there any BCL method that will give me…
CantSleepAgain
  • 3,743
  • 3
  • 21
  • 18
256
votes
12 answers

Getting the folder name from a full filename path

string path = "C:\folder1\folder2\file.txt"; What objects or methods could I use that would give me the result folder2?
Ash Burlaczenko
  • 24,778
  • 15
  • 68
  • 99
256
votes
4 answers

Get java.nio.file.Path object from java.io.File

Is it possible to get a Path object from a java.io.File? I know you can convert a path to a file using toFile() method, but I couldn't find the opposite conversion. Is there a way to do this in Java 6 or lower?
Karlovsky120
  • 6,212
  • 8
  • 41
  • 94
250
votes
8 answers

How can I list the contents of a directory in Python?

Can’t be hard, but I’m having a mental block.
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270