PATH
From Hackepedia
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
To see your current PATH:
$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
What this means, is if the application you're trying to run is in a directory listed in your PATH, then you don't have to type the complete /path/to/the/application. In this example, I'm trying to run a command called foo in /home/user/bin/
$ foo foo: command not found
$ /home/user/bin/foo Command Initialized, welcome to FOO!
but I don't want to have to type out /home/user/bin/foo every single time. How you set your PATH depends on your shell.
$ echo $SHELL
bash
$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
The long way:
$ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/user/bin/ $ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/user/bin/
The easier way:
$ export PATH=$PATH:/home/user/bin/ $ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/user/bin/
csh
$ echo $PATH /sbin:/bin:/usr/sbin: $ set PATH=/sbin:/bin:/usr/sbin:/home/user/bin/ $ echo $PATH /sbin:/bin:/usr/sbin:/home/user/bin/