LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-21-2004, 05:54 AM   #1
sonesay
Member
 
Registered: May 2004
Location: AUCKLAND
Distribution: Fedora core 2 , RH9
Posts: 64

Rep: Reputation: 15
weird command problem in linux


I'm using rh9. sometimes i get command not found or unkonwn when i try and use commands like"service" or "ifconfig" . I dont know whats wrong . sometimes it works and then it dosent for some reason. I notice this happends at school at well. is there anyone else who has this problem?

heres it from my screen:

[ninja@P1 ninja]$ service
-bash: service: command not found

[ninja@P1 ninja]$ ifconfig
-bash: ifconfig: command not found


[ninja@P1 ninja]$ [ninja@P1 ninja]$
-bash: [ninja@P1: command not found


this is very weird .. i have no idea what is going on.
 
Old 05-21-2004, 06:15 AM   #2
sbogus
Member
 
Registered: May 2004
Location: Germany, Munich
Distribution: SuSE Pro Releases 7.3, 9.0, CentOS 4.0, Kubuntu 6.0x
Posts: 103

Rep: Reputation: 15
Hi sonesay,

these command require (probably) root access. Try to type in su - provide the root password and then type in the commands you like.

Kind regards,
sbogus
 
Old 05-21-2004, 06:30 AM   #3
tiger7007
Member
 
Registered: Aug 2003
Distribution: RedHat9/FedoraCore1
Posts: 73

Rep: Reputation: 15
its becouse users usally dont have access to full path's in linux thats why you need to write the full PATH for example "/sbin/ifconfig" or "/sbin/route" unless ur loging as root or editing the path's for ur user ull have to write down full path now to learn about path's just do "info path" or if u simply want to edit ur paths trough the console the command form is :
PATH=$PATH:/folder/folder1 <- to add search path as last from right
PATH=/folder/folder1:$PATH<- to add search path as last from left


*NOTE*
u might have to edit this paths as roots also the path's are being searched from the left to the right.

GoodLuck

Last edited by tiger7007; 05-21-2004 at 06:34 AM.
 
Old 05-21-2004, 06:31 AM   #4
sonesay
Member
 
Registered: May 2004
Location: AUCKLAND
Distribution: Fedora core 2 , RH9
Posts: 64

Original Poster
Rep: Reputation: 15
thanks for your reply sbogus .. but I have tried those commands as root .. same problem. i used the su command to change and entered my root password. .. this is really really weird.
 
Old 05-21-2004, 06:34 AM   #5
sonesay
Member
 
Registered: May 2004
Location: AUCKLAND
Distribution: Fedora core 2 , RH9
Posts: 64

Original Poster
Rep: Reputation: 15
damn i dont know whats going on.. i log in as root and the service command works now.. i dont know why it wouldnt work before. sorry if this seems like a dumb question but its been bothering me for weeks. it happends and then works fine again.
 
Old 05-21-2004, 06:36 AM   #6
verstapp
Member
 
Registered: Feb 2004
Location: canberra australia
Distribution: Suse 9.0
Posts: 44

Rep: Reputation: 15
However, *some* of those commands, eg ifconfig, may be used by users but live in the /sbin directory. Root gets /sbin included as part of his path, common users don't. You might try typing /sbin/<command> and seeing if that works before going the su route. Of course you will have to remember on a command-by-command basis which commands require root and which require /sbin (and which live in /bin and don't require either).
 
Old 05-21-2004, 06:40 AM   #7
sbogus
Member
 
Registered: May 2004
Location: Germany, Munich
Distribution: SuSE Pro Releases 7.3, 9.0, CentOS 4.0, Kubuntu 6.0x
Posts: 103

Rep: Reputation: 15
Quote:
Originally posted by sonesay
thanks for your reply sbogus .. but I have tried those commands as root .. same problem. i used the su command to change and entered my root password. .. this is really really weird.
well then, try to locate where these commands are installed. As tiger7007 says, it could be that you do not have in your PATH environment the full paths to these scripts/executives.

As root, type in whereis service and see what you get as result. If you get nothing (i.e. a line like service:) then some wrong settings in the bash environment or general installation errors might be occured. Try to list each directory know to have executables in it. Try


ls -lha /bin
ls -lha /usr/bin
ls -lha /usr/sbin


and etc.
If whereis command goves you some full path to "service" then you might want to try it using the given full path.

For example
/usr/sbin/service

Kind regards,
sbogus
 
Old 05-21-2004, 06:43 AM   #8
sonesay
Member
 
Registered: May 2004
Location: AUCKLAND
Distribution: Fedora core 2 , RH9
Posts: 64

Original Poster
Rep: Reputation: 15
tiger7007 your right tiger.. thanks now i know what is going on... how do i search for a particulary command location if i only konw the command name?
 
Old 05-21-2004, 07:55 AM   #9
anandj
Member
 
Registered: May 2004
Distribution: Fedora Core 4
Posts: 92

Rep: Reputation: 15
The fact that you are finding the command intermittently means that sometimes your PATH has been set and sometime it hasn't.

If you log in as
User: root
passwd:

your path would be set by your config files (.bashrc etc)

but if you log in as a user and then do 'su' it might not be scanning the root's .bashrc file.

So if you have to do 'su' then type 'su -' (su minus)
AJ
 
Old 05-21-2004, 08:07 AM   #10
sonesay
Member
 
Registered: May 2004
Location: AUCKLAND
Distribution: Fedora core 2 , RH9
Posts: 64

Original Poster
Rep: Reputation: 15
cool thanks for that. its a really handy feature.
 
  


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
Linux NewB with weird problem ? TRUSTpunk Linux - Hardware 9 12-31-2004 10:45 PM
Weird sound problem in Xandros Linux 2.0 fl0ppy Linux - Software 1 03-20-2004 03:58 PM
Weird problem with linux. warTUX Linux - Newbie 3 03-19-2004 02:47 AM
Weird command TazLinux Linux - General 2 06-12-2003 08:25 AM
Weird cd command errors tarballedtux Linux - General 2 06-08-2003 09:53 AM


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