E-Mail:
Author Avatar

Finding the Path

Finding the Path

A week or so ago, we talked about modifying the PATH variable to add a directory. This variable makes it possible to use relative rather than absolute pathnames in your commands. For instance, if your PATH variable includes the directory /usr/bin, all the executable programs in that directory will be available simply by entering the command name.

Is there a quick and easy way to find out which directories are included in the PATH variable? You bet there is. A simple two-word command will echo all the directories in the PATH variable out to the screen.

    echo $PATH

What you’re likely to see returned as the result of this command is something like this:

/usr/local/bin:/usr/bin:/usr/X11R6/bin:.

This is a complete list of all the directories the PATH variable searches for the command you’ve entered. Each is separated from the next by a colon. If you have the same command in different PATH-defined directories, only the first will be searched. In other words, PATH only looks as far as it needs to for a command.

Thanks to PATH, you don’t have to look for most commands at all.

What Do You Think?

 


Anti-Spam Image

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!

Author Avatar
Interview, Linux, Misc - Dec 19, 2007

KOffice vs OOXML: Practical, Not Political

Author Avatar
Myths - Dec 3, 2007

5 Myths That Stymie Linux Growth

Author Avatar
Just Ask Matt - Linux Edition - Nov 20, 2007

Default Sound Card Not Sticking In Ubuntu!