Unix command that lists the files, sockets, and other file-descriptors that processes have open.
Questions tagged [lsof]
236 questions
1
vote
0 answers
macOS get notification for connection creation in the system
I was wondering if there's any user-space way to register socket creation function and get notification for each new socket created and inspect its characteristics (ip/port/protocol).
Perhaps lsof or fsevents has some programmatic api for this task…

Zohar81
- 4,554
- 5
- 29
- 82
1
vote
1 answer
Check what files are being used by process?
I have a standard web app written in PHP. I am using nginx with php-fpm.
Lets say public/index.php is my entry point and during a single request 25 files are being autoloaded.
Can I get a list of these files using some lsof or other command (I do…

Kamil Latosinski
- 756
- 5
- 28
1
vote
1 answer
lsof select only socket opened by an user
I can get the socket in listen state opened by an user with this code
lsof -sTCP:LISTEN -n -i -P |awk '$3 == "user" { print $0 }'
I would like to now if there is an option to lsof that also filter by user (or by process name by the way). I know…

drizzt.dourden
- 683
- 8
- 20
1
vote
1 answer
Trying to pass some output of lsof -Pi to geoiplookup
Looking for a way to pass the second column of output to geoiplookup, ideally on the same line, but not necessarily. This is the best I can muster. It's usable, but the geoiplookup results are unfortunately below the list of connections. I wanted…

Jer
- 81
- 1
- 5
1
vote
1 answer
http: Accept error: accept tcp [::]:9000: accept4: too many open files; retrying in 1s
the pid of the process is 1996291.
there are 65534 fds in /proc/1996291/fd, most of the fds are sockets, like this:
lrwx------ 1 root root 64 Dec 30 13:59 10000 -> socket:[952574733]
lrwx------ 1 root root 64 Dec 30 13:59 10001 ->…

lutaoact
- 4,149
- 6
- 29
- 41
1
vote
1 answer
Solr says it's running on port 8983 but can't access admin panel, also lsof missing
My Solr version is 7.2.0 and Java version: openjdk version "9-internal"
After I run bin/solr start, it says this:
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983
But I can't install lsof, because I…

sunergos
- 129
- 2
- 14
1
vote
2 answers
How to find NOT open files with lsof
Say, I got a specific task to find files that are not open. I understand how to get a list of open files with lsof (lsof +D). Furthermore I need to find them only in so called 1st level subdirectories. To do this i use find command with maxdepth 1…

Burn_jacks
- 45
- 5
1
vote
0 answers
How do I find and terminate a process listening to a port when I can't find it on my machine?
Attempting to kill port and locate possible process paths
I'm trying to use the Postgres.app to utilize the database, but keep running into the "Port in use" issue. I had originally brew installed postgres, but opted to use the app instead. So I…
1
vote
0 answers
opened file can't be seen with lsof
I wrote the following scripts(the two scripts are at the same directory),
script A,
#!/bin/bash
. B.sh
script B,
#!/bin/bash
echo "script B..."
read -rsp $'Press enter to continue...\n'
After executing script A, I found when 'Press enter to…

Matt Elson
- 4,177
- 8
- 31
- 46
1
vote
0 answers
lsof output present deleted file names with ; and some string
I'm trying to understand the output of my lsof command, more specifically, several deleted files with ";58a07f8b" after their name.
This is happening to more processes like bash or ssh.
I'm using lsof version 4.87, on CentOS Linux release…

yon2k2
- 29
- 2
1
vote
1 answer
Why "lsof -wni tcp:3000"
When I encounter "a server is already running" I use below command to solve this issue
lsof -wni tcp:3000"
kill -9 pid
I undertand lsof, but don't understand why "-wni", does anybody know what "-wni" stands for?
Also I could use lsof -i tcp:3000,…

Marcfly7
- 13
- 5
1
vote
1 answer
Why doesn't lsof show that libstdc++ is loaded on Mac OS X?
I have an application that I know uses libstdc++, but even as the super user, I cannot see /usr/lib/libstdc++.6.0.9.dylib on my Mac OS X 10.6 Snow Leopard system?
lsof | grep libstdc++
If I use DYLD_LIBRARY_PATH to use my own copy of libstdc++ it…

Juan
- 3,667
- 3
- 28
- 32
1
vote
1 answer
Why isn't "lsof" telling me the PID of the process that's running?
I’m on Mac Sierra. I’m trying to start my Tor instance, but evidently it is already running on my computer …
localhost:myproject davea$ tor --CookieAuthentication 0 --HashedControlPassword "" --ControlPort 9050 --SocksPort 50001
Nov 12 12:27:06.777…

Dave
- 15,639
- 133
- 442
- 830
1
vote
0 answers
LSOF DEL File Descriptor Confusion
The man page for lsof gives the following description for the DEL FD:
DEL: for a Linux map file that has been deleted;
The answer in below article seems to suggest that the file in the NAME column of the lsof output has been accessed by the process…

Sam
- 161
- 1
- 14
1
vote
1 answer
Alignment of columns in lsof and ps
I was working on parsing the output of popen to lsof and ps.
I was wondering is the first and last column always left aligned? And the rest in between are always right aligned? And as seen in column FD, is the minimum width of a column 3?
For…

Noitidart
- 35,443
- 37
- 154
- 323