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.
Print current PATH settings in C SHELL
Open the terminal and type the following command to print the current $PATH settings. You can use any one of the following command:
The character between each directory in the C shell's the PATH environment variable has colons. You can also use the following $path variable:
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/local/sbin/modemZapp /Users/vivek/gcutil-1.8.4
The character between each directory in the C shell's $path variable is a space. The C shell search path includes /usr/bin, /bin, /usr/sbin, and rest of the all directories displayed by the echo command.
Method #1: CSH / TCSH set path variable command for interactive use
You can add a directory called /usr/local/bin and $HOME/bin to to the search path by entering the following command:
### *** NOTE: $path is case sensitivity and must be in lowercase *** ### set path = ($path /usr/local/bin) echo $path
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/local/sbin/modemZapp /Users/vivek/gcutil-1.8.4 /usr/local/bin
All directories are searched in the order they appear in the search path. Setting paths with $path variable is recommended for all your shell commands that you type directly. You can add second path using the same syntax:
### *** NOTE: $path is case sensitivity and must be in lowercase *** ### set path = ($path /usr/local/bin $HOME/bin) echo $path
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/local/sbin/modemZapp /Users/vivek/gcutil-1.8.4 /usr/local/bin /Users/vivek/bin
Method #2: Csh/Tcsh add to $PATH
You can use the following syntax:
## please note 'PATH' is CASE sensitivity and must be in UPPERCASE ## setenv PATH $PATH:/dir/path1 setenv PATH $PATH:/dir/path1:/dir/path2
Please feel free to replace /dir/path1 with the directory you want the shell to search.
How do I set path in tcsh/csh automatically on Unix/Linux?
You may want to set search path automatically each time you log in by appending any one of the following command in ~/.login or ~/.cshrc file (you need to type the command at shell prompt):
## command to append path settings in ~/.login file ## echo 'set path = ($path /usr/local/bin $HOME/bin .)' >> ~/.login
## command to append path settings in ~/.cshrc file ## echo 'setenv PATH $PATH:/usr/local/bin:$HOME/bin:.' >> ~/.cshrcTweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop