LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-11-2004, 05:22 PM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
Angry bash -command not found-


Hi guys
I do not know why this happens, and if anyone can help I would be thankful
The story is that sometimes when I use the bash console, I enter common and know commands and it just says "command not found" For example:

[root@localhost aliserver]# ifconfig
bash: ifconfig: command not found

Although Iam logged in as root, and although ifconfig is a common command.
Please help me guys . Iam using RH 9.0
 
Old 09-11-2004, 05:27 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Let me guess .. you logged in as a normal user
and then used su?

Try again, this time with "su -" ... the
- is important, otherwise you inherit the normal
users path which shouldn't have sbin in it.



Cheers,
Tink
 
Old 09-11-2004, 05:45 PM   #3
scottman
Member
 
Registered: Jul 2004
Location: USA
Distribution: Slackware, FreeBSD, LFS
Posts: 72

Rep: Reputation: 15
It sounds like the command you are trying is not in your current
PATH. When you type a command on the prompt, bash checks
for it's file in all folders inside your PATH environmental variable.

To check your PATH

# echo $PATH

To find the location of a command

# which [command name]

Depending on your configuration, if you open a shell as a user,
then su root, your PATH will still be that of the user you su'd from.
Most users don't have access to /sbin directory's, as they contain
a lot of commands for system admin type activities. So what you
will need to do as root is add a directory to your PATH variable.

# PATH=$PATH:/sbin

This ads /sbin to the existing PATH. If you are using slackware,
you will probably want to add /usr/sbin.

# PATH=$PATH:/usr/sbin

Now bash will search those directories for the command you are
trying to use. To see the changes

# echo $PATH

Once you have figured out what directories you want to add to
you PATH, you can add these to your ~/.bashrc file to have them
executed when you enter the shell. This should also work when
you su from another user.

Hope this helps
 
Old 12-30-2006, 12:41 PM   #4
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Both solutions work perfectly


Note: Iam checkin all my posts to check if there are any issues I have resolved but not posted to that other users can benefit "That is why Iam that late"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: command not found! Adil_uk Linux - General 14 04-09-2012 01:04 AM
bash: pg: command not found Chomper Programming 2 02-05-2005 02:22 AM
-bash: cp: command not found johnlittlepeap Fedora 2 11-15-2004 08:52 AM
bash -command not found- K3V Linux - Newbie 7 09-30-2004 03:57 PM
bash: command not found jc80 Fedora 3 03-14-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration