LinuxQuestions.org
Register a domain and help support LQ
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 03-05-2010, 09:04 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Rep: Reputation: 32
Why cannot run lsof?


I type lsof and want to see the opened files but I got
Code:
-bash: lsof: command not found
But I can find the lsof is under /usr/sbin/lsof


Why?
 
Old 03-05-2010, 09:08 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

lsof is probably not in your path (you are running the command as none root user, aren't you).

Include the whole path when calling the command. I.e: /usr/sbin/lsof <options>

Another, less preferable solution would be to add /usr/sbin to your PATH (it isn't included for a reason...).

Hope this helps.
 
Old 03-05-2010, 09:10 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Try to search the Absolute path of executable
Code:
whereis lsof
 
Old 03-05-2010, 09:10 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
.....or you can simply run the command as root.

To check what is in your path, do this:
echo $PATH
 
Old 03-05-2010, 09:15 AM   #5
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
thomas2004ch

Name the distribution YOU ARE USING:

Path of lsof on Suse : /usr/bin/lsof
so lsof worked as a non-root on my OpenSuse 11.2

but as you say
Quote:
Originally Posted by thomas2004ch
But I can find the lsof is under /usr/sbin/lsof
sbin is not in the PATH

You need root permissions for that !!

Last edited by TheIndependentAquarius; 03-05-2010 at 09:27 AM.
 
  


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
using lsof command rheosiva Linux - Newbie 2 04-02-2009 02:36 AM
using lsof command rheosiva Linux - Security 1 04-01-2009 09:56 AM
lsof redirect WRXSTi Programming 8 10-02-2006 04:45 PM
What to do when lsof fails.... SpacedCowboy Linux - Security 2 10-29-2005 03:39 PM
Lsof Is Useless?? Philip_38 Linux - Software 3 01-30-2005 10:24 AM


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