For the Unix and Linux beginners: How to display the common PATH-like environment variables

A regular Linux and Unix user should know how to use the PATH, CDPATH, MANPATH and HOME environment variables, in the bash shell.

With the PATH and the CDPATH set in the right way, you can easily use your commands and scripts.

Display the PATH and CDPATH with echo, like any other variable:

$ echo $PATH

$ echo $CDPATH

The MANPATH is used by the Linux and Unix manual (man).

Display the MANPATH:

$ manpath -g

The HOME is not PATH-like, but it is often used in shell scripts, and it is the same as tilde ~, expanding in the user’s homedir.

$ echo $HOME

You can see a list of the most common PATH-like variables here.

Tagged with: , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!