LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-19-2003, 06:17 PM   #1
pdmackenzie
Member
 
Registered: Dec 2002
Location: toronto
Distribution: mandrake 10
Posts: 135

Rep: Reputation: 15
Why do commands work sometimes, but not others?


'Which', for example. I used 'urpmi' to install it a few weeks ago, and used it several times successfully. Today, however, (logged in as root) when I used the command "which foo" I received the response:
"bash: which: command not found" yet "man which" has an entry and when I run "urpmi which" I receive the response
"Everything already installed"

It is all very confusing...

regards,
doug
 
Old 09-19-2003, 06:40 PM   #2
gizmogadgetus
Member
 
Registered: Aug 2003
Location: Texas
Distribution: Fedora Core 2
Posts: 71

Rep: Reputation: 15
make sure you're the same user/path

sometimes that will happen if you type the command as a different user. The problem is that different users have different paths, so sometimes linux does not know "where" to find a command depending upon the path
 
Old 09-19-2003, 08:35 PM   #3
pdmackenzie
Member
 
Registered: Dec 2002
Location: toronto
Distribution: mandrake 10
Posts: 135

Original Poster
Rep: Reputation: 15
Hello!
That is all well and good, but to run urpmi one has to be root, so when it was installed it would have been with root as owner. As to the path, one must assume that urmpi (the mandrake version of rpm) would install the program in a directory that is in the path!

doug
 
Old 09-19-2003, 10:35 PM   #4
gizmogadgetus
Member
 
Registered: Aug 2003
Location: Texas
Distribution: Fedora Core 2
Posts: 71

Rep: Reputation: 15
Unfortunately, packages get installed where the creator of the package designates them, not into the path of the installer. So just installing it with urpmi, kpackage, rpm, yast2, portage, apt-get, or any other type of package manager doesn't mean it will be in your path. It just means its installed. So it's completely possible that it's not in your path at all. If a program is installed, and you can't run it, almost invariably you will find it is an issue with where the program is, not it's stability. Additionally, roots' path is not the same as other users' paths. Just because root can see it, doesn't mean everyone else can too. In fact the opposite is usually true because root is the trusted superuser and can run software that no other user should.
 
Old 10-30-2004, 09:15 PM   #5
pdmackenzie
Member
 
Registered: Dec 2002
Location: toronto
Distribution: mandrake 10
Posts: 135

Original Poster
Rep: Reputation: 15
But even if this is the case, why would the command function properly for a while, then stop being found?

doug
 
Old 10-31-2004, 07:05 AM   #6
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
run "updatedb"
then type "locate which"
this will give you the path of the which program
after this, as root (either login as root or do a "su -" (note the hyphen, it's very important)) do a "echo $PATH" and see if the paths match ie:
Code:
# updatedb
# locate which
/usr/bin/which
# echo $PATH
/usr/bin;/sbin;/usr/sbin;/bin;/root/bin
This indicates that "which" is in my $PATH, though it may not be in yours.
 
  


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
root commands don't work Fetch Linux - Newbie 3 01-24-2005 11:22 AM
commands, some work some dont? Balkman Linux - Newbie 5 07-23-2004 12:58 PM
Why don't my WineX commands work? cheeseincarnate Linux - Software 18 07-19-2004 04:33 PM
some bash commands dosen't work Username[SWE] Linux - Newbie 4 04-10-2004 01:53 AM
Commands dont work, even as root king_nothingzzz Linux - General 2 01-22-2004 04:07 PM


All times are GMT -5. The time now is 08:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration