Re: Where is lsof?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux