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, 06: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: 670
Blog Entries: 7

Rep: Reputation: 31
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, 06:27 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 06: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, 01: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: 670
Blog Entries: 7

Original Poster
Rep: Reputation: 31
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 02:04 AM
bash: pg: command not found Chomper Programming 2 02-05-2005 03:22 AM
-bash: cp: command not found johnlittlepeap Fedora 2 11-15-2004 09:52 AM
bash -command not found- K3V Linux - Newbie 7 09-30-2004 04:57 PM
bash: command not found jc80 Fedora 3 03-14-2004 04:11 PM

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

All times are GMT -5. The time now is 09:00 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration