Unix command that lists the files, sockets, and other file-descriptors that processes have open.
Questions tagged [lsof]
236 questions
1
vote
1 answer
finding out which ports a program/process ist listening to - lsof, netstat
Under Ubuntu I'm having an interactive program that I'm suspecting it is hanging listening on a specific port, don't know which one.
It is a shell script that invokes a java command in its last line.
How can I easily find out the ports it is…

Krischu
- 1,024
- 2
- 15
- 35
1
vote
1 answer
Meaning of *:* in lsof output
On Solaris (or Unix), running lsof gives me a bunch of lines like this:
java 25375 foo 8161u IPv4 0xfffffeb1f6f523c0 0t0 TCP *:* (IDLE)
But the *:* puzzles me - I was expecting to see something like…

Ben Aston
- 53,718
- 65
- 205
- 331
1
vote
0 answers
Where is my parent process sending it's STDERR?
I tried to make the title succinct, but couldn't think of a way to totally encapsulate the question. Here's what I want to do: when running a perl script, I want to know if there are any other processes other than 'myself' that have a connection to…

hepcat72
- 890
- 4
- 22
1
vote
0 answers
lsof - how to cross - compile for ARM architecture
Inb4 use busybox.
I need to have the flag HASSECURITY disabled. In busybox the flag is enabled, and I do not see any way to change the compilation flags of buysbox'es components(however if there is a way to do it - i would like to learn about…

Chris
- 570
- 2
- 9
- 19
1
vote
1 answer
How to extract exact data from a file?
I have used this command - lsof +D /usr/bin and generated following output -
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
metacity 1347 gdm txt REG 8,1 609760 278555 /usr/bin/metacity
tail 1474 root txt REG 8,1…

Shah9il
- 61
- 1
- 8
1
vote
1 answer
Is it possible to control which libraries apache uses?
Okay, so I had an earlier problem with PIL that is still unresolved. Someone else had this problem and had success by removing the old JPEG library. I can't really do that on my machine, however, as it's RHEL and so many things are dependent on…

Jordan Reiter
- 20,467
- 11
- 95
- 161
1
vote
1 answer
Give a file descriptor number, is there any way to know its type?
I have a program and somewhere it leaks the file descriptors, so I want to add a monitor thread to detect the process open fds, if the fd is a "PIPE" , I will close it.
I could use lsof -p or cat /proc/pid/fd to get the process number, and I could…

python
- 1,870
- 4
- 24
- 35
1
vote
1 answer
Change the of the output in lsof in linux
I would like to obtain different result with lsof, I mean just want to show some columns,
is it possible?
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd DIR …

John Lapoya
- 582
- 1
- 8
- 21
1
vote
1 answer
No Output Displayed when i run and echo lsof in cgi - Ubuntu
I have recently started using cgi. As I have to display port usage information about certain ports, I had written the following code:
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo…

Shine Cardozo
- 489
- 5
- 16
1
vote
0 answers
Android: lsof: two sockets and a pipe - what could that possibly be?
In my android app, I get a "Too many open files" exception. When I do a lsof, I get a long (and growing) list of open pipes. However in my case, both pipe end points are in my app. Another strange thing: just before having the two pipes I always…

ToBe_HH
- 678
- 6
- 9
1
vote
1 answer
process won't die after being killed with `kill` command
I'm trying to run rails server to start a local server but got this error
...
WARN TCPServer Error: Address already in use - bind(2)
Exiting
...
So I went and looked for the process that was occupying the port and killed it.
The server still…

user1508893
- 9,223
- 14
- 45
- 57
0
votes
1 answer
Odd difference between Python 2.5 and Python 2.6 on MacOS 10.6 using ctypes and libproc proc_pidinfo
I'm trying to determine the current working directory of a process given its PID. The command-line utility lsof does something similar. Here's the source to the python script:
import ctypes
from ctypes import util
import sys
PROC_PIDVNODEPATHINFO…

cemasoniv
- 1
- 2
0
votes
1 answer
Get number of connections of determinated port
Looking for a linux function that returns the count of connections in a port.
Was researching about the "lsof", but it only prints connections in a door, and does not return the sum of all connections, for example: if I have two connections at port…

guisantogui
- 4,017
- 9
- 49
- 93
0
votes
0 answers
Discrepancy between JMX getOpenFileDescriptorCount and lsof -p | wc -l
I have a very big ulimit -n 300k for the user.
My Java program encounter “Too many open files” exception. To debug this, I run lsof -p PID | wc -l and the output value is a lot less than that ulimit. That means I don't reach FD limit.
I use jmx…

user2563050
- 69
- 1
- 4
0
votes
0 answers
Using libproc to get ports used by processes on macos
I am trying to get ports by processes. It can be done via lsof on macOS, i am trying to do it via libproc.
#include
#include
int main(int argc, const char * argv[]) {
pid_t pids[3072];
int count =…

faisal
- 1
- 2