How to add a directory to my path?

I've got no idea... One difference I can think of is the search PATH used for commands might be different. (Causing the shell to traverse different directories when looking for the commands to run)

My cache_dirs lives in /boot/custom/bin. I invoke it like this in my "go" script. my drives spin down just fine. I add /boot/custom/bin to the execution path in the "go" script.
(This is my whole "go" script.)
# Start the Management Utility
/usr/local/sbin/emhttp &
cache_dirs -w -e Pictures -e data -d 3
fromdos < /boot/custom/bin/powerdown > /sbin/powerdown
chmod u+x /sbin/powerdown
fromdos < /boot/custom/etc/rc.d/S30-inittab-powerdown | sh
fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh
echo "/boot/unmenu/uu" | at now + 1 minute

I'm tring to figure out how to add a directory to the path but am having no luck. I found this example from Joe L. which is the exact...
0 0

When you type the name of an executable file, GNU/Linux searches for that executable in all the directories specified in the PATH environment variable.
By default, your GNU/Linux distribution probably set up a default PATH variable during install. To see what your current PATH variable is set to, in a terminal window, type:
echo $PATH
and press ENTER. The system should respond by writing out the current value of the PATH variable. That probably looks something like:
To add a directory to the PATH statement is a relatively straight forward process, but first a question needs to be answered:
Note that these instructions are for a bash shell which is very common n GNU/Linux systems. If you are running another shell, please consult the directions for that shell.
Which users do you want to be affected by this new PATH value?
1. In a home GNU/Linux system, it’s likely that there is only one user and therefore the answer is:...

0 0
Adding a Directory to the Path Copyright (C) 2002 by Steve Litt [ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ] Adding a directory to the path of a user or all users would seem trivial, but in fact it isn't. The best place to add a directory to the path of a single user is to modify that user's .bash_profile file. To add it to all users except user root, add it to /etc/profile. To also add it to the path of user root, add it to root's .bash_profile file. Obviously, you use this document at your own risk. I am not responsible for any damage or injury caused by your use of this document, or caused by errors and/or omissions in this document. If that's not acceptable to you, you may not use this document. By using this document you are accepting this disclaimer.

Linux determines the executable search path with the $PATH environment variable. To add directory /data/myscripts to the beginning of the $PATH environment variable, use the...

0 0

Sometimes you may need to add a directory to the Linux PATH, and the reason to do this, could be to have some scripts you may have written included in the execution PATH.

This is done easily by with a single command line, but that is going to last only until you reboot the machine or, if logout and loggin again, so If you want to make it permanent, you may need to edit some config files, there is one global, and there are also specific ones for each user, you may choose which according to your needs. Add a directory to the PATH only for this session

To do this, just run this command from the shell.

export PATH=$PATH:/new/directory


export PATH=/new/directory:$PATH

Add a directory to the PATH of your user only

Just add one of the above commands to the .bash_profile file, if you are using bash, you will have to choose the appropriate one if you are using another shell, you may also add these two lines instead of the above one

0 0

ow do I add a new path to $PATH variable under Linux and UNIX like operating system? What is my path, and how do I set or modify it using csh/tcsh or bash/ksh/sh shell?

The PATH is an environment variable. It is a colon delimited list of directories that your shell searches through when you enter a command. All executables are kept in different directories on the Linux and Unix like operating systems.

Finding out your current path

To find out what your current path setting, type the following command at shell prompt. Open the Terminal and then enter:


Sample outputs:


How do I modify my path?

To modify your path edit $PATH variable as per your shell. The syntax for setting path under UNIX / Linux dependent upon your login shell.

Bash, Sh, Ksh shell syntax to modify $PATH

If you are using bash,...

0 0


Setting the windows command path in Windows 7

Additional information:

Modifying the path statement will enable an MS-DOS window opened in Microsoft Windows as well as older programs to locate files that may be required to run the program.

In the old MS-DOS environment we used the PATH= command, located in the autoexec.bat file. Additional information about the MS-DOS path command that is still usable in Windows 2000 and Windows XP can be found on our path command page, additional information about the MS-DOS command can be found on our set command page.

See our dictionary path definition for additional information about this term and related definitions.


The path is now managed by Windows 7 and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.

From the desktop, right-click My Computer and click Properties. ...
0 0

Users can run an executable from windows command prompt either by giving the absolute path of the file or just by the executable file name. In the latter case, Windows searches for the executable in a list of folders which is configured in environment variables. These environment variables are as below.

1. System path
2. User path

The values of these variables can be checked in system properties( Run sysdm.cpl from Run or computer properties). Initially user specific path environment variable will be empty. Users can add paths of the directories having executables to this variable. Administrators can modify the system path environment variable also.

How to set path from command line?

In Vista, Windows 7 and Windows 8 we can set path from command line using ‘setx’ command.

setx path "%path%;c:\directoryPath"

For example, to add c:\dir1\dir2 to the path variable, we can run the below command.

setx path "%path%;c:\dir1\dir2"


0 0

The environment variables control the behavior of the shell. Environment variables are the variables that set the working environment of the shell. Some of the environment variables are USER, HOME, SHELL, PWD, SHELL, PS1, PS2 etc. The HOME variable contains the path of home directory of the user. Similarly other variables contain other values needed for the operation of shell. This article discusses an important shell environment variable PATH and how you can add values to this variable.

Display Variable Value

The shell interprets the value of a variable by the $ sign. To display the value of a variable, precede the variable with $ sign. The "echo" command is used to display the value of the variable. Let us display the value of the variable HOME:

$ echo $HOME

The PATH variable

The commands in Unix/Linux are the binary executable files. When you enter a command at the shell prompt, binary file with that name is executed. So...

0 0

Windows 8 and 10
Windows Vista and Windows 7
Windows 2000 and Windows XP
What is the default Windows Environment Path?
Setting path in the MS-DOS and Windows command line

Setting the path and variables in Windows 8 and Windows 10

From the Desktop, right-click the very bottom left corner of the screen to get the Power User Task Menu. From the Power User Task Menu, click System. Click the Advanced System Settings link in the left column. In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom of that tab. In the Environment Variables window (pictured below), highlight the Path variable in the "System variables" section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32

Note: You can edit other...

0 0

How do I set or change the PATH system variable?

This article applies to:

Platform(s): Macintosh OS X, Oracle Linux, Red Hat Linux, SUSE Linux, Solaris SPARC, Windows 7, Windows 8, Windows Vista, Windows XP

The instructions on this page are intended for advanced users or system administrators.

General Information

The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window. The PATH system variable can be set using System Utility in control panel on Windows, or in your shell's startup file on Linux and Solaris. Making changes to the system PATH variable is typically not necessary for computers running Windows or Mac OS X.


Windows 10 and Windows 8 In Search, search for and then select: System (Control...
0 0

A path set in .bash_profile will only be set in a bash login shell (bash -l). If you put your path in .profile it will be available to your complete desktop session. That means even metacity will use it.

For example ~/.profile:

if [ -d "$HOME/bin" ] ; then PATH="$PATH:$HOME/bin" fi

Btw, you can check the PATH variable of a process by looking at its environment in /proc/[pid]/environ. (replace [pid] with the number from ps axf)


bash as a login shell doesn't parse .profile if either .bash_profile or .bash_login exists. From man bash :

it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

See the answers below for information about .pam_environment, or .bashrc for interactive non-login shells, or set the value globally for all users by putting a script into /etc/profile.d/ or use /etc/X11/Xsession.d/ to affect the display...

0 0

A. The system path is a list of folders, separated by a semicolon, that identifies the folders that the system should search when looking for files that are called from the Run dialog box, command line, or other processes. Normal program installation changes this path to include the program's installation path.

See also, "How do I add a folder to the Windows 2000/Windows XP PATH, in a batch?" and "Securing the Windows Search Path."

To change the system path, perform these steps:

Start the System Control Panel applet (Start - Settings - Control Panel - System). Select the Advanced tab. Click the Environment Variables button. Under System Variables, select Path, then click Edit. You'll see a list of folders, as this example for my system shows: C:\Program Files\Windows Resource...
0 0

Linux determines the executable search path with the $PATH environment variable. To add directory /data/myscripts to the beginning of the $PATH environment variable, use the following:


To add that directory to the end of the path, use the following command:


But the preceding are not sufficient because when you set an environment variable inside a script, that change is effective only within the script. There are only two ways around this limitation:

If, within the script, you export the environment variable it is effective within any programs called by the script. Note that it is not effective within the program that called the script. If the program that calls the script does so by inclusion instead of calling, any environment changes in the script are effective within the calling program. Such inclusion can be done with the dot command or the source command.


$HOME/ source...
0 0

To give a bit more explanation, Python will automatically construct its search paths (as has mentioned above and here) using the script (typically located in sys.prefix + lib/python/site-packages as well as lib/site-python). One can obtain the value of sys.prefix:

python -c 'import sys; print(sys.prefix)'

The script then adds a number of directories, dependent upon the platform, such as /usr/{lib,share}/python/dist-packages, /usr/local/lib/python/dist-packages to the search path and also searches these paths for .pth config files which contain specific additional search paths. For example easy-install maintains its collection of installed packages which are added to a system specific file e.g on Ubuntu it's /usr/local/lib/python2.7/dist-packages/easy-install.pth. On a typical system there are a bunch of these .pth files around which can explain some unexpected paths in sys.path:

python -c 'import sys; print(sys.path)'

So one can create a .pth file and...

0 0
0 0

On Windows 7, XP, Vista, 2008, 2012 and up:

Go to Control Panel and open the System icon (Start в†’ Control Panel)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System Variables' pane

Find the Path entry (you may need to scroll to find it)

Double click on the Path entry

Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)

Press OK

On Windows 98/Me you need to edit the autoexec.bat file:

Open the Notepad (Start в†’ Run and enter notepad)

Open the C:\autoexec.bat file

Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and add: ;C:\php to the end of the line

Save the file and restart your computer

Note: Be sure to reboot after following the steps above to ensure that the PATH changes...

0 0
0 0

In this age of PowerShell, I would edit PATH like so:

$PATH = [Environment]::GetEnvironmentVariable("PATH") $xampp_path = "C:\xampp\php" [Environment]::SetEnvironmentVariable("PATH", "$PATH;$xampp_path")

To set the variable for all users, machine-wide, the last line should be like:

[Environment]::SetEnvironmentVariable("PATH", "$PATH;$xampp_path", "Machine")

In a PowerShell script, you might want to check for the presence of your C:\xampp\php before adding to PATH (in case it has been previously added). You can wrap it in an if conditional.

So putting it all together:

$PATH = [Environment]::GetEnvironmentVariable("PATH") $xampp_path = "C:\xampp\php" if( $PATH -notlike "*"+$xampp_path+"*" ){ [Environment]::SetEnvironmentVariable("PATH", "$PATH;$xampp_path", "Machine")...
0 0

To make this work for the command line (terminal):

I would suggest that you do the following steps in the terminal:

(1) Create a folder called bin in your home directory.

mkdir ~/bin

(2) Add ~/bin to your PATH for all sessions of Bash (the default shell used inside of the terminal).

nano ~/.bashrc # Add the following to the end of your .bashrc file while using nano # or your text editor of choice: export PATH="/home/$USER/bin:$PATH"

(3) Add either the executable files themselves OR symlinks to the executable into ~/bin

(4) Restart your terminal session by closing out the terminal and reopening it.

That should allow your terminal to read the PATH variable for terminal sessions.

I do not know how to add it to the GUI, though, as I'm not certain of how the GUI manages the PATH variable(s), but it might be necessary to modify the path with other methods should this method here not work with the...

0 0