Questions tagged [lsof]

Unix command that lists the files, sockets, and other file-descriptors that processes have open.

236 questions
4
votes
1 answer

Meaning of lsof -i output

I have run the command sudo lsof -i tcp:46265 Output COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 4580 mysql 30u IPv4 70185524 0t0 TCP localhost:mysql->localhost:46265 (ESTABLISHED) java 53105 root 54u IPv6…
Ravi
  • 2,472
  • 3
  • 20
  • 26
4
votes
1 answer

What are the number of open files for a user on linux and system wide for linux?

Sorry, this question has several layers but all deal with the number of open files. I'm getting a "Too many open files" message in my application log for the app we're developing. Someone suggested to me to: Find the number of open files currently…
Classified
  • 5,759
  • 18
  • 68
  • 99
4
votes
3 answers

Verify whether ftp is complete or not?

I got an application which is polling on a folder continuously. Once any file is ftp to the folder, the application has to move this file to some other folder for processing. Here, we don't have any option to verify whether ftp is complete or…
Liju Mathew
  • 871
  • 1
  • 18
  • 31
3
votes
1 answer

Socket not listed in lsof but is listed in netstat

When I do "lsof -nl | egrep "TCP|UDP" " in order to see socket states, I notice that the sockets that I expected to be listed are not at all, but when I do a "netstat --tcp", they are listed, but are in a CLOSE_WAIT state. What I know so far is…
Sandra E
  • 55
  • 6
3
votes
0 answers

java Kafka send messages in docker is increasing open files (lsof ) at almost 50/sec

My java web application is running in docker container. Java application is sending messages to Kafka (~ 300 msgs/hour). The server is crashing very few hours. I need tot restart the server every few hours at this time. I see that the number of…
firemonkey
  • 329
  • 4
  • 18
3
votes
2 answers

Getting all open files for process results in errno 12 = Out of Memory

With the help of SO, I wrote an app that displays all open TCP/UDP connections in Swift. In the next step, I would like to get the process that opened the connection (pretty much as lsof does). Since lsof is open source, I could write the following…
inexcitus
  • 2,471
  • 2
  • 26
  • 41
3
votes
1 answer

Is there any way for lsof to show the entire argv array instead of just argv[0]

I currently have a python script that accomplishes a very useful task in a large network. What I do is use lsof -iTCP -F and a few other options to dump all listening TCP sockets. I am able to get argv[0], this is not a problem. But to get the full…
adam
  • 384
  • 2
  • 9
3
votes
1 answer

lsof always report offset equal to file size in OSX

I've tried to estimate, how much of the file my program has processed, and for me an obvious solution was to use lsof -o. But surprisingly, OFFSET in lsof's output was always equal to SIZE (like in lsof -s --), so I decided to write some simple…
folex
  • 5,122
  • 1
  • 28
  • 48
3
votes
1 answer

Strange behavior using lsof and awk together in Mac terminal?

I want to find all of the lines in lsof with "Google" in them, so I tried the following: lsof | awk '/.*google.*/ { print $1 "," $2 "," $3} ' > new_file.csv which yields correctly an output with rows starting with the word "google". But, then I…
makansij
  • 9,303
  • 37
  • 105
  • 183
3
votes
1 answer

Debug Where Spam script on Linux is

My Linux server is sending out large amounts of spam and so far the only information I have to identify where this is coming from is the following: lsof -f | grep smtp ---- results perl 21655 apache 54u IPv4 1795658 …
TheLipster
  • 33
  • 7
3
votes
1 answer

Creating and deleting files from C/C++

I seem to be confused about how file removal works on Linux (same behavior on Mac OS X). The following code writes a 1GB file and then immediately deletes it. It does so 1024 times. I thought that since the file is closed, it would be immediately…
foxcub
  • 2,517
  • 2
  • 27
  • 27
3
votes
1 answer

Using bash and watch to monitor qemu-kvm

I'm trying to monitor some qemu-kvm processes using a bash script and watch to show several details like memory/cpu use, resources, ports,etc. Everything is going great until I try to get the IMG file that qemu-kvm is using. Initially I thought I…
madnexus
  • 31
  • 5
3
votes
2 answers

xargs not working with lsof

When I run pgrep vim | xargs echo, it prints 93868 91234. When I run lsof -p 91234, it prints: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME vim 91234 rose cwd DIR 1,2 1326 1186863…
Rose Perrone
  • 61,572
  • 58
  • 208
  • 243
3
votes
1 answer

Spring RmiExporter service fails after successful startup

I'm experiencing a situation where an RMI Service configured using Spring's RmiServiceExporter is starting up just fine, and is usable for a while - then after some unknown amount of time, the service is unavailable even though the java process for…
Stewart
  • 17,616
  • 8
  • 52
  • 80
3
votes
2 answers

Bash on OSX: How to determine if network file (AFP) is in use?

I've got a bash script that runs on OSX. It needs to manipulate some files on a network-share (AFP share on a Synology NAS). Unfortunately those files are sometimes still being written when the script runs. How do I determine if the file is in use…
Tonny
  • 671
  • 5
  • 17