Unix command that lists the files, sockets, and other file-descriptors that processes have open.
Questions tagged [lsof]
236 questions
2
votes
2 answers
kill not working in while loop
I want to kill all processes given by lsof in a while loop.
this works fine:
lsof -i tcp | grep -v iceweasel | awk '{ print $2 }' | while read -r line
do
echo "$line"
done;
this one does not:
lsof -i tcp | grep -v iceweasel | awk '{ print…

achille
- 113
- 8
2
votes
2 answers
lsof open files count not same
I want to know the count of opened files of each process so I use the lsof command with:
lsof -n | awk '{print $2}'|sort |uniq -c |sort -nr| more
And I found a process with pid "934" opened 11374 files but when I use
lsof -p 934 | wc -l
it is…

Exia
- 2,381
- 4
- 17
- 24
2
votes
2 answers
How to record file access over 24 hrs?
I often fail to run apt-get install on my server. Like that:
$ sudo apt-get install tmux
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource
temporarily unavailable)
E: Unable to lock the administration directory…

Michael Heuberger
- 822
- 3
- 10
- 27
2
votes
1 answer
Mounted docker volume to host directory contains only files from the last container
I'm launching multiple linked containers. All containers mount host directory /var/log/tipsi/ to the same called internal directory. The problem I see files in /var/log/tipsi only from the last container:
tipsi_solr and tipsi_erl has the same files…

ZAN
- 561
- 1
- 4
- 16
2
votes
1 answer
Find which process is listening on port 8001 on Mac OS X
How can I see which process is listening on port 8001 on Mac OS X?
I have tried several commands:
lsof -i | grep LISTEN
Output:
qbittorre 321 user 26u IPv4 0xc8e6037f28270c31 0t0 TCP *:6881 (LISTEN)
qbittorre 321 user 27u IPv6…

tonix
- 6,671
- 13
- 75
- 136
2
votes
1 answer
find and kill process which running on port
I'm trying to kill the process associated with port 161 (SNMP) on OS X.
I tried to get the process ID associated with this port using netstat and lsof but none of these seem to list PIDs:
$ netstat -an | grep 161
udp4 0 0 *.161 …

anish
- 6,884
- 13
- 74
- 140
2
votes
1 answer
Too much open files Exception under "unlimited" system
I am seing a lot of too many open files exceptions in the execution of my program. Typically those occur in the following form:
org.jboss.netty.channel.ChannelException: Failed to create a selector.
...
Caused by: java.io.IOException: Too many…

fabiim
- 825
- 2
- 9
- 18
2
votes
1 answer
Recovery deleted but running python script
I am running a python script python a.script on a linux box (I know all process information about it from /proc), but I accidentally run 'rm a.script', How can I recovery the script? I found this How do I determine the path to a binary of a…

schemacs
- 2,783
- 8
- 35
- 53
2
votes
1 answer
Finding Socket Options set for a FD
I need to find the socket options set for a File descriptor.
For example, the accept call returns a FD. I set a number of socket options. Then I need to find if the socket options are actually set for the FD.
P.S: setsockopt is not returning an…

ankit409
- 93
- 7
2
votes
1 answer
Ignoring directories from a file
I am in the process of creating a script that lists all files opened via lsof output. I would like to checksum specific files and ignore directories from that output but am at a loss to do so EFFECTIVELY. For example: (I'm using FreeBSD btw)
lsof |…

munkeyoto
- 299
- 1
- 9
2
votes
0 answers
How to know which application is using the microphone
Possible Duplicate:
Can we detect which android application is using the microphone?
I want to detect which application is using the microphone.
Suppose two applications have access to the microphone. For an application to use the microphone, it…

chiv
- 165
- 1
- 2
- 15
1
vote
2 answers
LSOF connection established
I was wondering, if the output of
lsof -i
sshd 21880 root 3r IPv4 4843515 TCP somehost.lu.isp.com:ssh->d-XX-XXX.ITS.SOMEWHERE.COM:45037 (ESTABLISHED)
sshd 21882 mike 3u IPv4 4843515 TCP…
Mike
1
vote
2 answers
Node.js lsof - many open DB connections
When I run "lsof | grep node" on my server (running a node.js app), I get about 1000+ lines (db connections to port 9160). Each line looks like this:
node 17006 root 160u IPv4 1362100969 0t0 TCP…

awaage
- 2,669
- 1
- 17
- 15
1
vote
0 answers
Trying to figure out why empty files like /tmp/fc007620c1c8dcca are being created
Example of the empty files created in /tmp:
-rw------- 1 root wheel 0B Mar 27 00:57 fc007620c1c8dcca
-rw------- 1 root wheel 0B Mar 27 01:00 fc007620c1c95a20
-rw------- 1 root wheel 0B Mar 27 01:01 fc007620c1c9c4e3
This is on a…

Linda Derezinski
- 11
- 1
1
vote
0 answers
Is there a situation where curl can access a port that lsof doesn't to?
What could have led to this? [doge]

user2685761
- 41
- 6