O'Reilly logo

Shell Scripting Recipes: A Problem-Solution Approach, Second Edition by Jayant Varma, Chris F. A. Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 7

image

Treading a Righteous PATH

The PATH variable is a colon-separated list of directories that your shell will search for a command. It usually includes /bin, /usr/bin, and /usr/local/bin. If you are root, it will also include /sbin and /usr/sbin. There may be other directories, and there may even be a dot, which puts your current directory in the PATH. For example, a typical user’s $PATH looks like this:

/usr/bin:/bin:/usr/local/bin:/usr/games:/usr/X11R6/bin:/home/chris/bin

Whenever you enter a command without a full path (e.g., ls instead of /bin/ls), the shell searches the directories listed in your PATH variable for the command. If all ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required