LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 08:04 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
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, 08:08 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 08:10 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

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

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

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

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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 Aquarius_Girl; 03-05-2010 at 08:27 AM.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:57 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
Open Source Consulting | Domain Registration