[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-list
Subject:    Re: Where is lsof?
From:       "Sharpe, Sam J" <sam.sharpe+lists.redhat () gmail ! com>
Date:       2009-05-05 15:37:18
Message-ID: 4A005D2E.8070501 () gmail ! com
[Download RAW message or body]

Mikkel L. Ellertson wrote:
> Alan Evans wrote:
> > On Tue, May 5, 2009 at 5:39 AM, Mike Cloaked wrote:
> > > Usually a good way to find where a command is would be to use the 
> "which"
> > > command. In this case:
> > > [mike@gestalt ~]$ which lsof
> > > /usr/sbin/lsof
> > How is that going to work if /usr/sbin isn't already in your path?
> > 
> It does work. Try it yourself.
> 
> $ which lsof
> /usr/sbin/lsof
> $ echo $PATH
> /usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mikkel/bin
> 
You'll note that /usr/sbin *is* in your path and the man page for which 
says:

DESCRIPTION
       Which takes one or more arguments. For each of its arguments it 
prints
       to stdout the full path of the executables that would have been exe-
       cuted when this argument had been entered at the shell prompt. It 
does
       this by searching for an executable or script in the directories 
listed
       in the environment variable PATH using the same algorithm as bash(1).

So if you hadn't had /usr/sbin in your PATH, then "which lsof" would 
have returned nothing - so it isn't useful for this situation...

[sam@sam ~]$ echo $PATH
/usr/kerberos/bin:/usr/bin:/bin:/usr/sbin:/sbin
[sam@sam ~]$ which lsof
/usr/sbin/lsof
[sam@sam ~]$ export PATH=/usr/kerberos/bin:/usr/bin:/bin:/sbin
[sam@sam ~]$ which lsof
/usr/bin/which: no lsof in (/usr/kerberos/bin:/usr/bin:/bin:/sbin)


--
Sam

-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic