During custom compiling of applications, sometimes you will see error messages like the following:
make: depmod: Command not found
That doesn’t necessarily mean your computer doesn’t have something installed, but it could mean the program just couldn’t find it.
Here is how to fix it:
First thing is to find the program in question “depmod”, run:
updatedb locate depmod
The first command should update the file location database, and the second should find it.
According to my results:
[root@localhost]# locate depmod /etc/depmod.d /etc/depmod.d/depmod.conf.dist /sbin/depmod /usr/share/man/man5/depmod.conf.5.gz /usr/share/man/man5/depmod.d.5.gz /usr/share/man/man8/depmod.8.gz
it’s at “/sbin/depmod”
If it doesn’t show up, you probably don’t have the correct package installed, you should find the package and install it via yum or apt-get
Assuming it’s installed, we need to let the compiling program know where to find it.
To do that simply run (changing /sbin to whatever folder you found the app in above):
PATH=$PATH:/sbin export PATH
We now added /sbin to the path, so now when the compiling program tries to run depmod, it will automatically run /sbin/depmod
However, this will be cleared after your session is over.
If you want the modified PATH variable to persist to other sessions/reboots, you will need to add those lines to a file:
For a Single User:
vim $HOME/.bash_profile #Change PATH=$PATH:$HOME/bin #to include the folders you want to add PATH=$PATH:$HOME/bin:/sbin
For the root user, it is the same as a Single User except edit the file:
vim /root/.bash_profile
For All Users except root
vim /etc/profile #at the end of the file add: PATH=$PATH:/sbin
Making changes to those files will require a logout/login or reboot to take effect. So in the meantime you could just run:
PATH=$PATH:/sbin export PATH
You can do this with other folders as well.
For Example,
I use it for directories I store my scripts in. So instead of running,
“/home/user/scripts/myscript” everytime I want to run that script
I can just run
“myscript”
Just by adding /home/user/scripts to my PATH
Resources:
http://www.troubleshooters.com/linux/prepostpath.htm
One thought on “Adding a Directory to Linux PATH Environment Variable”
Comments are closed.