LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why cannot run lsof? (https://www.linuxquestions.org/questions/linux-newbie-8/why-cannot-run-lsof-793395/)

thomas2004ch 03-05-2010 08:04 AM

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?

druuna 03-05-2010 08:08 AM

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.

vinaytp 03-05-2010 08:10 AM

Try to search the Absolute path of executable
Code:

whereis lsof

pixellany 03-05-2010 08:10 AM

.....or you can simply run the command as root.

To check what is in your path, do this:
echo $PATH

Aquarius_Girl 03-05-2010 08:15 AM

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 !!


All times are GMT -5. The time now is 12:55 PM.