LinuxQuestions.org
Review your favorite Linux distribution.
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 06-26-2007, 06:17 PM   #1
Legolas327
Member
 
Registered: Apr 2006
Location: Atlanta, GA
Distribution: Ubuntu 9.10
Posts: 69

Rep: Reputation: 15
Bash command not found


Why do I get the "bash ????? command not found" for all of my lsmod, lsusb, lspci .etc commands?

distro: FC5 kernel-2.6.20-1.2312.fc5


Here is an example:
Code:
[mythtv@245 sbin]$ ls -l lsmod
-rwxr-xr-x 1 root root 6356 May 10  2006 lsmod
[mythtv@245 sbin]$ su
Password:
[root@245 sbin]# lsmod
bash: lsmod: command not found
[root@245 sbin]#
I know this is stupid like pathing or something but I am running these from within /sbin so not sure what I am doing wrong.
 
Old 06-26-2007, 06:29 PM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
try /sbin/lsmod
 
Old 06-26-2007, 06:46 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
SciYro is right - use the full path to the command, or if you are in /sbin directory, try ./lsmod. By default, the current directory is not included in the path. There's a discussion on the merits of this here at http://www.linuxquestions.org/questi...d.php?t=562410
 
Old 06-26-2007, 06:47 PM   #4
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,961

Rep: Reputation: Disabled
/sbin is not in users path, su gives root rights without switching the environment. Try su -.
 
Old 06-26-2007, 06:51 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Use "su -" to use roots PATH variable.

Also make sure that the package with lsmod is installed.

You can also include the path with sudo:
sudo /sbin/lsmod
 
Old 06-26-2007, 07:33 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
It's true that using su - will provide access to the root account which does have /sbin in its path. However, commands like the ones posted by the OP (lsmod, lsusb, lspci) don't require root privileges to run.
 
Old 06-26-2007, 08:02 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by gilead
It's true that using su - will provide access to the root account which does have /sbin in its path. However, commands like the ones posted by the OP (lsmod, lsusb, lspci) don't require root privileges to run.
Quite true--there are several choices:
su - to get root's PATH
add the directories to the user's PATH
use the full pathname
 
Old 06-27-2007, 05:47 PM   #8
Legolas327
Member
 
Registered: Apr 2006
Location: Atlanta, GA
Distribution: Ubuntu 9.10
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
try /sbin/lsmod
---> WORKED
Quote:
Use "su -" to use roots PATH variable.
---> WORKED
 
Old 06-27-2007, 07:04 PM   #9
Legolas327
Member
 
Registered: Apr 2006
Location: Atlanta, GA
Distribution: Ubuntu 9.10
Posts: 69

Original Poster
Rep: Reputation: 15
Why does "su -" but not just "su" without the "-" ?

I added /sbin/ to my Path so now I should not face this again.
Quote:
[mythtv@245 ~]$ export PATH=$PATH:/sbin/
Thank you very much
 
Old 06-27-2007, 07:44 PM   #10
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
From the man page for su: The "-" character tells su to provide an environment similar to what the user would expect had the user logged in as root directly.

It gives you choices about how your environment is structured for different system tasks.
 
  


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: g++ command not found briemac Programming 14 12-31-2006 01:31 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: command not found intels_ss Linux - Newbie 5 07-20-2005 07:41 PM
bash: pg: command not found Chomper Programming 2 02-05-2005 02:22 AM
bash -command not found- K3V Linux - Newbie 7 09-30-2004 03:57 PM

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

All times are GMT -5. The time now is 02:31 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