Unix command that lists the files, sockets, and other file-descriptors that processes have open.
Questions tagged [lsof]
236 questions
0
votes
0 answers
How to decrease many opened files by MySQL in "lsof" command?
There are large number of MySQL tables, it's more than thousands tables.
A few tables is accessed in short time, a large number of tables is accessed in long time. And it's shown many files opened a few hours ago in result of "lsof" command.
#…

quenty658
- 1,587
- 2
- 10
- 7
0
votes
0 answers
Cannot pass sucessifuly through healthcheck with lsof
I've tried to up a docker-compose with three services, but it fails on healthcheck.
It is made by searching a specific running port with lsof: test: ["CMD", "lsof", "-t", "-i:3001"]
Nevertheless, when I try to reach the service by that specific…
0
votes
0 answers
How to track file lifetime using lsof?
I have read article https://tailscale.com/blog/case-of-spiky-file-descriptors/ where author investigates anomalies with the amount of open file descriptors.
He said that made snapshot of open files using lsof which allowed him to track lifetime of…

mouse_00
- 593
- 3
- 13
0
votes
2 answers
Find who is holding cryptsetup/LUKS encrypted home (some KDE/X vs common sense madness)
I'm fighting some ridiculous no-so-eeasy to debug case with my cryptsetup/LUKS encrypted home directory.
The setup: I have partition that is dedicated to my user home directory and encrypted with cryptsetup/LUKSv2 (lets call this user "crypted").…

e-pirate
- 153
- 1
- 10
0
votes
0 answers
Analyse opened file descriptors
Noticed that the number of file descriptors on the server is growing every day. After analyse i find problem daemon php process, and i see multiple TCP socket connections, by i do not see them in listening or established. I really do not…

quaresma89
- 137
- 8
0
votes
0 answers
lsof command on Solaris not able to find memory mapped files?
I created a sample program mmap to map the /dev/mem, want to see how could lsof find it. But found lsof didn't list the /dev/mem as the memory mapped file for the sample process:
root@sx86:/u/gwz# lsof|grep mmap
lsof: WARNING: vxfsu_get_ioffsets()…

user2906783
- 11
- 4
0
votes
1 answer
Two processes listen on the same port (using Jersey), but not responding to same requests
I have two very simple apps listening on TCP HTTP 4466. Both use Jersey 2.X but one is a native-image and the other is a java UncompiledMain.java process (I'm trying to migrate to java native images instead of JIT compilation):
COMMAND PID …

Sridhar Sarnobat
- 25,183
- 12
- 93
- 106
0
votes
1 answer
lsof -i output explanation
Google said
lsof
-i [i] selects the listing of files any of whose Internet address
matches the address specified in i. If no address is
specified, this option selects the listing of all Internet
and x.25…

Alex
- 562
- 1
- 6
- 25
0
votes
1 answer
How to print out the access right from linux kernel module
When I run the command lsof from a terminal, it will show a detail list of all file descriptor with a header is FD. And FD column numbers like 1u is actual file descriptor and followed by u,r,w of it’s mode as:
r for read access
w for write…

Anh Hoang
- 117
- 4
- 10
0
votes
1 answer
Use of watch and lsof + grep together
When i use
lsof -p 3536693 | grep snapshot
I get an output
but if i try to
watch lsof -p 3536693 | grep snapshot
I get nothing. Aren't they compatible?
It works if I ommit grep, like
watch lsof -p 3536693

CrazyRabbit
- 251
- 3
- 10
0
votes
2 answers
How to use lsof inside of Makefile
Suppose I have something like
.PHONY: kill-server
kill-server:
kill -9 $(lsof -t -i :9000)
Why it doesn't work and how do I fix this?

Adil Akhmetov
- 121
- 1
- 1
- 7
0
votes
0 answers
lsof showing duplicates entry of files opened by elasticsearch
on lsof I can see there are multiple entries of the same files opened by elastic search.
The files are in format of elasticdb/data/nodes/0/indices/AW0VfnbAQB-7Z43UAXCUdw/0/index/_1.cfs
The interesting thing is on counting the duplicate occurrence I…

Arun Pal
- 687
- 7
- 28
0
votes
1 answer
Linux: how to know which process (or program) is sending data to a local port?
I launched a program that listens at 127.0.0.1:3000 on a CentOS server. I haven't sent any message to the program but it keeps receiving data. I want to know who is sending data to my program. So I type in the following command:
netstat -an | grep…

Richard Hu
- 811
- 5
- 18
0
votes
0 answers
lsof command output not piping to grep properly
I'm in a Ubuntu 18.04 environment, and I'm trying to grep the output of lsof to get some detailed info about files being locked on my system.
My command is simple, and goes like so:
sudo lsof | grep 'query'. This however, always contains the same…

tuskiomi
- 190
- 1
- 15
0
votes
1 answer
Timeout in Shell Script
Using Shell Script like below:
if [[timeout 60 | wsof -l]]; then
echo "thread sleeping for 60 seconds"
exit
else
echo "timeout failed"
exit
fi
But getting error timeout failed. How to apply timeout for 60 seconds so that return is echo "thread…
user4782805