LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   $PATH varibale (https://www.linuxquestions.org/questions/linux-newbie-8/%24path-varibale-162156/)

chongluo 03-25-2004 05:24 AM

$PATH varibale
 
I'm using fedora core 1
I find some of the commands are not in the $PATH varibale, such as shutdown, adduser/useradd, it is very annoying that i have to type the full path each time,
so i used
----------------------------------------------------------
export PATH=$PATH:/sbin
---------------------------------------------------------
to allow me to use the command, which works fine
however each time i reboot my computer, I'll have to reset those path varibale again.
1. so plesae advise how can i get them done without setting them after each reboot?
2. how can i get all the commands in $PATH varibale

jax8 03-25-2004 05:41 AM

place the above command in the

/etc/profile

file. Just add it at the end on a new line

acid_kewpie 03-25-2004 05:54 AM

you can add these to the users defauilt path in /etc/bashrc for bash or similar places. however root's path will nearly always contain these paths, so i'd suggest you looked at how you are trying to access these commands in the first place. You should not be using these commands as a non root user, that's why they are there, not in /bin etc...

chongluo 03-25-2004 08:11 AM

Quote:

Originally posted by acid_kewpie
you can add these to the users defauilt path in /etc/bashrc for bash or similar places. however root's path will nearly always contain these paths, so i'd suggest you looked at how you are trying to access these commands in the first place. You should not be using these commands as a non root user, that's why they are there, not in /bin etc...

I'm using these commands as a root, and i thought it should be in the root path, don't know why it is not??? any idea why it isn't

hw-tph 03-25-2004 08:42 AM

I have had similar problems with Redhat (7 point something). What I did was that I edited root's ~/.bashrc and added:
Code:

export PATH=$PATH:/usr/sbin/:/sbin
...and then I also made sure ~/.bashrc always was sourced from root's ~/.bash_profile:
Code:

if [ -e ~/.bashrc ]
then
    source ~/.bashrc
fi

This way no matter how you log in root will always have the /sbin and /usr/sbin directories in the $PATH.


Håkan

statmobile 03-25-2004 01:46 PM

Me too, I have RedHat 9, and for some reason this was not in my path for root either. Seems odd, but I did what hw said above before, and now it works like a charm. I wonder why RedHat doensn't have this automically.


All times are GMT -5. The time now is 05:06 PM.