Questions tagged [lsof]
49 questions
28
votes
3 answers
Continuously monitor files opened/accessed by a process
lsof -p 12345 will list all the files opened by process whose pid is 12345 but only for a particular instant of time.
How can we continuously monitor a process from the start to end(until process is terminated) to list/show every single file…
MA1
- 1,119
- 5
- 18
- 32
11
votes
2 answers
Closing open file without killing the process
I have java(yeah java...) application running on CentOS 7.
After a while, there are many "deleted" files that bother me.
for deleted files used(not the issue):
lsof | grep "(deleted)"
I found them in /proc/pid/fd/... and my question is how can I…
igor
- 423
- 1
- 11
- 25
7
votes
2 answers
How can I find all files open within a given directory?
I know I can use lsof to list open files, and I know I can use find to find files by inode within a given directory.
But how can I effectively combine these two programs to list all open files which are open within a given directory? Or is there a…
spraff
- 2,106
- 5
- 37
- 58
7
votes
1 answer
lsof reports no files open on external volume but it still cannot be safely unmounted
I've searched around here on SX and other places but have not found an approach that gives me any traction on my issue. I've a volume (used by Time Machine as it happens) on an external Firewire drive. When the drive is connected, it has 3…
fairflow
- 185
- 2
- 6
7
votes
2 answers
Debugging connection timeouts using strace?
I'm trying to figure out why is Eclipse spinning, so I decided to fire up strace.
I found the eclipse process using:
$ ps ax | grep java
5546 ? Sl 19:04 /usr/bin/java ... [arguments omitted]
By running strace on this process, I see that…
jabalsad
- 1,427
- 3
- 13
- 19
5
votes
2 answers
How can I print file names on linux command if know its file descriptor of a file opened by a process?
I know the file descriptor of a file opened by a process, but I don't know the process ID. How can I print file names from the Linux command prompt if I know the file descriptor of a file opened by a process?
techfun
- 417
- 3
- 7
- 10
5
votes
2 answers
Find processes listening on the wildcard address in `lsof`
Using lsof, I can find all of the processes with a TCP socket listening for connections:
lsof -Pni -sTCP:LISTEN
e.g.:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cupsd 662 root 7u IPv6 11108 0t0 TCP [::1]:631…
benizi
- 537
- 5
- 15
4
votes
2 answers
Can't unmount dmg. Keep getting "Resource Busy"
"Workspace" is an encrypted dmg where I keep my code. I don't usually unmout it but I need to take a backup and it's refusing to let me unmount:
mark@mark-macbook-air /Volumes$ lsof | grep Workspace
mark@mark-macbook-air /Volumes$ lsof…
Mark
- 141
- 1
- 1
- 3
4
votes
2 answers
How can I programmatically “eject” a keychain on OS X?
I'm using a script to eject a small USB key I use as a “identity” drive, which contains some secure information. Of note, it has an OS X “keychain” file on it, which contains some of my more secure and important passwords (those I'm willing to…
ELLIOTTCABLE
- 2,315
- 3
- 27
- 41
4
votes
1 answer
How to install lsof on Debian/kFreeBSD?
How do you install lsof on Debian/kFreeBSD Testing (Wheezy/Sid)?
$ apt-get install lsof
Package lsof is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from…
basic6
- 2,587
- 9
- 33
- 41
3
votes
1 answer
Is there a way to know WHEN a connection has been established?
I'm working with mobile IPv6 and was dealing with lots of zombie connections. I set keepAlive to true and want to test whether old connections are being discarded.
I'm using lsof to list the process connections, but I can't tell how old the…
Marcio Aguiar
- 131
- 2
2
votes
3 answers
Listing active *and past* network connections
On Linux, I know that I can list active network connections with lsof -i or netstat. However, as far as I know, this only list connections that are currently open.
If a process makes a short connection and then terminates it (like, for instance, a…
Federico Poloni
- 355
- 1
- 3
- 14
2
votes
2 answers
Mac lsof command find all processes for all users
A while ago my teacher asked me to create a script that would kill Minecraft anytime it came up. It worked when the user themselves ran it, but it didn't if it was at root level.
Is there a command similar to lsof that found all processes, not just…
Hovestar
- 145
- 9
2
votes
1 answer
How to convert lsof hexadecimal IP:port output to decimal notation?
I feel dumb for asking but how do I convert this to the IP port combination?
IPV4 0xffffff8015f9aa40
tcv
- 543
- 2
- 5
- 15
2
votes
1 answer
Periodically printing the number of open files for a process
I can use a program like top to periodically update system statistics and I can use lsof -p | wc -l to give me a snapshot of the number open files for a process. Is there a command I can call that, like top, will periodically show me the…
ericg
- 544
- 2
- 6
- 16