LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command not found (https://www.linuxquestions.org/questions/linux-newbie-8/command-not-found-23344/)

murshed 06-13-2002 11:52 AM

command not found
 
hi all,

when i enter as a user in my RedHAt 7.3 .. the command line doesn't work mostly ..

i tried this command as a n example ..
shutdown -h now

but this message appeard:

bash: shutdown : command not found





what is the problem?

best regards

dorward 06-13-2002 12:08 PM

The "shutdown" program isn't in a directory listed under your $PATH.

Try /sbin/shutdown instead.

trickykid 06-13-2002 12:08 PM

its not in your path.

are you root or a regular user ? if your a regular user, most likely there's a chance the user doesn't have permissions as well to use that command.

type $PATH to display a users current path.
edit your /etc/profile or .bashrc , .bash_profile in your user's home directory to add permanent path's to one's profile.

man chmod for details on permissions.

also, this is asked all the time, a quick search on the site would probably turn up many posts with answers.

murshed 06-13-2002 03:15 PM

thanks alot .. i will try them:)

thanks

murshed 06-18-2002 02:22 PM

it is strange!
when i try to do : ifconfig ... as i said . command not found

i then cd to /sbin
and do ls
i see ifconfig there .. but when i type ifconfig in that dir .. it still shows command not found!!! thats when i am root ( well i enter as a user and i su)

when i type (if) and then tab .. it doesn't show that there is any thing like ifconfig ... and when i do ls -la .. ifconfig is not with the files that start with if ... but when i do ls .. it is there!!!


/sbin was not in my path though .. but i went into the dir .. no use


what is the problem?:(

thanks

dorward 06-18-2002 02:57 PM

Being in the directory isn't enough unless "." is in your path.

On most systems a
Code:

su -
will make you the superuser with roots default path settings, including /sbin.

Otherwise you can just type the path to the file.
Code:

/sbin/ifconfig
or
Code:

cd /sbin
./ifconfig


jglen490 06-18-2002 03:18 PM

When you switch to the superuser enter:

su -

Just "su" doesn't bring the root environment with it, whereas "su -" does bring it. If you don't have the environment you can't act as root after an "su".

murshed 06-19-2002 10:06 AM

woow .. it worked ..

it worked when i did su - ... and i did the . thingy and worked:) then i did /sbin to the user's path by:

PATH=$PATH:/sbin

and i could ifconfig wherever the user is:)

thanks all

best regards

nguyenntt 11-22-2007 04:51 AM

Quote:

Originally Posted by murshed (Post 106048)
woow .. it worked ..

it worked when i did su - ... and i did the . thingy and worked:) then i did /sbin to the user's path by:

PATH=$PATH:/sbin

and i could ifconfig wherever the user is:)

thanks all

best regards

Hi, you can add DOT in to ~/.bash_profile

$ su
$ vi[or emacs] ~./bash_profile

you will see PATH=$PATH:$HOME/BIN then edit like PATH=$PATH:$HOME/BIN:.

==>> add :. in the end of BIN

mMay be restar your system to take effect


All times are GMT -5. The time now is 01:13 AM.