Questions tagged [lsof]

Lsof is a tool to list opened files by processes

Lsof is a tool to list on its standard output file information about files opened by processes.

102 questions
6
votes
4 answers

Log network traffic with process ID on Mac OS X?

I want to log all network traffic on a Mac OS X server (like tcpdump does), but including the ID of the process that is responsible. Using lsof only gives me the current connections, not the past ones. Is there a way to do this? Regards, Jochen
Jochen
  • 191
  • 1
  • 1
  • 7
5
votes
3 answers

How to find full process arguments and associated listening ports?

I can execute netstat -atulpn | grep java to find all Java processes with their accompanying ports, which is great, however I would like to also have the processes full execution arguments also shown. I don't believe that this is possible with…
ylluminate
  • 1,001
  • 2
  • 15
  • 29
5
votes
1 answer

How can I list all accessed files on process startup

I have a process that fails on startup due to some permission issues. I want to check what files it tries to open on startup but with lsof I can list only opened files for a running process but what can I do when it fails to start?
martin
  • 345
  • 1
  • 7
  • 14
5
votes
1 answer

Why is rpc.lockd obscured from netstat/lsof output?

Prologue: On a number of machines, which happen to act as NFS clients, netstat reports two ports that are open with no PID listed for an associated daemon. Ordinarily this might be a bit concerning. # netstat -lnp | egrep -- '- +$' tcp 0 …
Dan Carley
  • 25,189
  • 5
  • 52
  • 70
4
votes
3 answers

lsof for files opened by other users

How do I see the list of files open (lsof) in a specific directory and by other users? I can do lsof +D /path, but that only shows current user's files. Any way to see if other users have opened files in a directory?
Ash
4
votes
1 answer

Near 100% disk usage, df and du show very different results, lsof not the answer

The issue is that my CentOS 5.8 machine is telling me that I am nearly out of disk space when I am pretty confident this is not the case. I've done a fair amount of researching on this issue and have been unable to find a solution. 'df -h' shows…
edwaa
  • 49
  • 2
4
votes
2 answers

how to list files that are NOT open using find command

I want to "list" all the files that are NOT open, within a certain directory using the GNU find command. Now, I am able to list the files that are open, but can't figure out a way to do the inverse of it. find /my/dir/* -exec lsof {} \; Any…
puffadder
  • 143
  • 1
  • 4
4
votes
1 answer

In lsof output what are those 'sock' lines?

In lsof command under Ubuntu/Debian, I'm seeing a lot of lines like below: PROGRAM 829 root 140u sock 0,8 0t0 244182 protocol: TCP What are these lines? Can they be results of failed TCP connection attempts?
Daniel
  • 193
  • 1
  • 2
  • 8
3
votes
2 answers

How to find the other point of a Unix domain socket on Mac OS X to write/read it?

I listed open file for a process (a daemon) on my box which runs Mac OS X 10.5 : >lsof -p 89 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ... xxxxx 89 xxxxxxxx 9u unix 0x34f8990 0t0 ->0x34f8880 I 'd like…
yves Baumes
  • 268
  • 4
  • 9
3
votes
2 answers

lsof doesn't show the established TCP connection

On my system, if I run the netstat for a port, it returns: $ netstat -nat | grep "60964" tcp 0 0 192.0.0.1:60964 0.0.0.0:* LISTEN tcp 59 0 192.0.0.1:60964 192.0.0.6:46962 …
brokenfoot
  • 155
  • 5
3
votes
1 answer

Custom lsof output

The following command produced the unix domain socket opened by PID 30661 $ sudo lsof -U -a -p 30661 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME haproxy 30661 haproxy 7u unix 0xc784a000 0t0 3348210055…
pradeepchhetri
  • 2,518
  • 6
  • 33
  • 45
3
votes
2 answers

How to determine which TCP/UDP ports are being opened by a given process (linux)?

I know how to do the opposite (find out what process has a given port open) using lsof or netstat, but extensive research on Google hasn't helped me solve the reverse problem. I know I could use "netstat -np" combined with some grep and sed, but it…
Alex G
  • 376
  • 1
  • 4
  • 13
3
votes
2 answers

trace opening on a certain file

I know how to strace a certain program to see all the files it reads. I know how to see what processes are using a certain file at the moment. But is there a way to log all file opens. I want something like tail -f some/log/file but instead lsof -f…
3
votes
1 answer

lsof runs REALLY slow when Chromium or Firefox is open

I have a little script that runs lsof on my laptop (Ubuntu Natty) every now and then to check for a few things. I recently noticed that it runs really slowly when I have Chromium or Firefox open. Without Chromium open: $ lsof | wc -l 5288 With: $…
Dane Larsen
  • 189
  • 1
  • 6
2
votes
1 answer

cant counting all open files by lsof + lsof is hung

we are tying to count all open files by lsof lsof | wc -l lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/42/gvfs Output information may be incomplete. but sill after 1 hour lsof not rerun answer ( like its stuck ) any other…
shalom
  • 451
  • 12
  • 26