Saturday, May 16, 2009

RHEL/CentOS CLI headaches

CentOS, and I would imagine RHEL as well, do not automatically include all of the program directories in the PATH variable by default like so many other distros do. For example, in CentOS, if you want to run the ifconfig program to check your IP address, you have to type this:
The reason for this is because the /sbin directory is not assigned to the PATH variable. This has caused me unnecessary aggravation. There are a few ways to deal with this. First is with the which command. Run this command:
which ifconfig
The output should say: "/sbin/ifconfig". You can use the which tool to locate command line utilities so if they are not assigned to the PATH variable you will be able to specifiy their full location in order to run them.

There is also a more permenant solution; add this line to your ~/.bashrc file:
Now restart your Terminal session and you will have all of those additional directories included in your PATH variable and won't need to specifiy the full location of their contained programs. To enable this for all users, add the line to the file located at /etc/profile. You need superuser privledges to edit that file.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.