Questions tagged [lsof]

lsof is a tool to list open files of processes

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

How can lsof -p $pid be stalling when ls /proc/$pid/fd is not?

I have a situation where I observe that BackupPC stalls for a particular host. This host runs Debian 10 (and has e.g. Docker installed). During that situation, two rsync-related processes are running ...
0
votes
1answer
42 views

the output of a perl script which calls “sudo lsof | grep username | wc -l” differs in cron vs manually

We are having issues with a perl script we run for file count: #!/usr/bin/perl $stat=`sudo lsof | grep username | wc -l`; $date=`date '+ %Y/%m/%d-%H:%M:%S'`; $exit=`echo $?`; if ( $...
0
votes
1answer
24 views

Is there a way to tell if tee is writing to a mounted filesystem?

I backup my hard drive through sudo zfs send snapshot | sudo tee /my-mount-point/my-snapshot.zfs > /dev/null, and I want to make sure that I don't accidentally unmount (and turn off) /my-mount-...
0
votes
1answer
22 views

Is it possible to output full command names with `lsof -nP -i4UDP`?

Is it possible to output full command name with lsof -nP -i4UDP? I've been looking in the manual for a suitable option, like -V (see below), but it doesn't result in full COMMAND names, i.e. systemd-...
1
vote
2answers
81 views

Check which network interface an SSH tunnel is using

I've got a server with 2 network interfaces. Due to a restrictive NAT firewall, it establishes an SSH tunnel to a server on the internet: ssh -fNTMS "/tmp/tunnel.socket" host; ssh -S "/tmp/tunnel....
-1
votes
1answer
65 views

how to know if we reached the max value of fs.file-max

On our Linux RHEL servers fs.file-max is set to 100000 sysctl -p | grep fs.file-max fs.file-max = 100000 From my understanding the file-max kernel parameter refers to open file descriptors, and file-...
3
votes
1answer
32 views

Limit for open files

I have a java application that is failing with java.io.IOException: Too many open files at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) ~[na:1.8.0-internal] at sun.nio.ch....
0
votes
0answers
36 views

nofile doesn't work as described in limits.conf

We encountered an issue in production, I suspect it may be caused by hitting the nofile limit, but I cannot find trace or direct proof. We are running on RHEL 7. I used lsof command below to find ...
1
vote
0answers
31 views

lsof +d doesn't work properly on live CD

mkdir testdir cat > testdir/whatever when running from live CD (Ubuntu) lsof +d testdir shows nothing while cat is still running Does it have something to do with overlay fs? Can the behaviour ...
2
votes
1answer
239 views

Why does lsof indicate my IPv4 socket is IPv6?

I am looking at the output of lsof -i and I am getting confused! For example, the following connection between my java process and the database shows as IPv6: [me ~] % lsof -P -n -i :2315 -a -p xxxx ...
0
votes
1answer
33 views

While appending text to a file, lsof doesn't show the file as being open / accessed

On one session I append some text to a file as below : while true;do echo some_text >> file1 ; done On another session from same dir I run : lsof file1 which returns no output. Any idea why ?...
0
votes
0answers
32 views

Can someone help me understand this lsof output I am seeing?

I am trying to figure out why my NiFi instance is saying there are too many files even though I have updated the limits to 50K per the documentation suggestions. I had to up it to 1,000,000 to do the ...
2
votes
1answer
67 views

Recover deleted folder that's still loaded by an active process

I'm really sorry if this question was asked before. I really need help with this as it involves very important data and I've been unable to do it for the past 2 hours. Essentially I accidentally ...
1
vote
1answer
149 views

List files a command opens? lsof is too slow

Is there some utility, that I can run a certain command A "within", that lists all files A opens while executing? I run a utility (A) that changes some password requirements and something is broket. ...
1
vote
0answers
156 views

Why does `lsof` list the open IPv6 network file (socket) when given the `-i4` option, but not when given the `-i6` option?

I have an open IPv6 network file (socket) that I want to inspect using lsof. What bugs me is that lsof reports the socket's type as IPv6, but it only shows it using -i4 option, not the -i6 option: $ ...
-3
votes
2answers
105 views

How can I find files that are not in use by any process and remove them?

I found that ~/.wine/drive_c/users/t/Temp/ has 1.4G bytes of files *.tmp. Some of them are in use by some processes (and I can tell for each file by lsof), and the other are not in use by any ...
6
votes
1answer
107 views

How to detect which process has used a file now or in the past

This is a hypothetical question, not a problem I currently have. How do you detect which process has used a file now or in the past? To find out which process is accessing filename right now, lsof ...
0
votes
1answer
74 views

How to interpret the port mapping strings under name column of lsof results?

I have the following output from lsof -i:portnumber [ztao@MongoDB ~]$ lsof -i:6379 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME redis-ser 5341 ztao 4u IPv6 23457 0t0 TCP *:...
1
vote
1answer
122 views

How to find max limit of /proc/sys/fs/file-max

I am running Jenkins with lots of jobs which require lots of open files so I have increased file-max limit to 3 million. It still hits 3 million sometimes so I am wondering how far I can go. Can I set ...
1
vote
1answer
805 views

Is it possible to force ending of (close wait) connections?

when we run lsof on port 6060 as the following # lsof -i TCP:6060 | more COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME app_lot 3495 root 12u IPv6 9238779 1t0 TCP *:krb0934 (...
0
votes
0answers
56 views

lsof show number of open files that are more then what configured [duplicate]

we verify the file max as [root@linux02 ~]# cat /proc/sys/fs/file-max 500000 but when we run lsof we get [root@linux02 ~]# lsof | wc -l lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/...
1
vote
0answers
76 views

Continuously monitoring network connections

I am looking for a network monitoring tool that can monitor all opened network connections in real-time and its output is easy to parse. What I want to achieve is auditing all in/out network ...
0
votes
2answers
1k views

Is there a python module for lsof?

Each time I try to update my Kali Linux by running sudo apt update I get the following error message Unable to lock directory /var/lib/apt/lists/ The way I fix this problem is by finding ...
1
vote
1answer
172 views

How do I confirm a file sync has completed before executing a command?

I have a computer periodically syncing folders of content with another computer using Resilio Sync. The receiving computer has a sorting process on an hourly cron, which analyses the folders and their ...
5
votes
1answer
111 views

How can I find what a process is trying to watch using strace, lsof, and fdinfo?

I have a process (the NewRelic infra agent) that is hung on a RHEL 7, xfs filesystem host. I'm thinking that it's trying to watch a file or maybe a socket that another process already has in use. ...
1
vote
2answers
1k views

Is lsof part of default RHEL installation?

I am trying to find out if lsof is part of a typical RHEL installation. I see lsof mentioned in a RHEL page titled Common administrative commands in Red Hat Enterprise Linux 5, 6, 7, and 8 but I do ...
0
votes
0answers
66 views

Why can't `lsof` report some open port's information? [duplicate]

I am running this with the IP address of the same machine: $ nmap -p0-65535 192.168.1.198 Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-20 10:13 EDT Nmap scan report for olive.fios-router.home (...
2
votes
1answer
178 views

Red Hat Linux - port is in listening state but could not find process ID

I have this problem for my application, port is in listening state but process ID is not showing up. Used below commands. This is cloud AWS server Red Hat Linux. $ netstat -tulpn tcp 0 ...
0
votes
2answers
1k views

kill deleted files and clean the memory cache

I want to know if kill the delete process , can help to clean the memory cache sometimes we get from lsof many deleted files so does killing them can give more available memory ? example: lsof | ...
0
votes
2answers
420 views

Does lsof always show the resolved absolute pathnames of opened files

In the output of lsof, does the NAME column always output the resolved absolute pathnames of opened files (resolved in the sense of no symlink, . or .. in the pathname)? For example, if I cd into ...
1
vote
2answers
150 views

How can I extract only the pid column and only the pathname column in the lsof output?

$ sudo lsof -u t | grep -i "\.pdf" evince 1788 t 37r REG 8,4 176328 134478 /home/t/some/path1/white space/string1 + string2 string3.pdf evince 3737 t 36r ...
0
votes
0answers
110 views

Why can I not kill a process in the same line I start it using fuser?

I have been trying to kill a process by looking at the listening port and nothing seems to be working. The code is as follows: (code to open port 8545) && fuser -k 8545/tcp I also tried with ...
3
votes
1answer
542 views

lsof versus /proc/$PID/fd versus ulimit -n

I am trying to find the reason why my long-running app sometimes busts the maximum open file descriptor limit (ulimit -n). I would like to periodically log how many file descriptors the app has open ...
0
votes
1answer
138 views

is it possible to avoid open files? [closed]

when we run lsof to capture deleted files , we see the following: ( example ) lsof +L1 java 193699 yarn 1760r REG 8,16 719 0 93696130 /grid/sdb/hadoop/hdfs/data/current/PLP-...
0
votes
0answers
105 views

Service stuck and consuming disk space

What is the best practice to avoid this case Example, filebeat 5098 5128 root 3r REG 253,1 31035908096 657022 /var/log/aaa/aaa.access.log.1 (deleted) There is a ...
2
votes
1answer
539 views

How shall I understand the output of `NAME` field of `lsof`?

$ sudo lsof +E -a -U -p 1480 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. lsof: WARNING: can't stat() fuse.gvfsd-fuse file ...
0
votes
3answers
269 views

Get a certain column of an output with content aligned right and some columns not always filled

This is a problem I often encounter, this time with the output of lsof, but I am searching for a general solution for such problems: selecting a column. Here I try to get the TYPE column of the ...
4
votes
2answers
2k views

lsof shows protocol: TCP

I ran sudo lsof -p $(pidof foo) and I got a lot of these. Does anyone know what these represent? I know they come from the process but there are no ports / IP addresses. COMMAND PID USER FD ...
1
vote
1answer
231 views

lsof doesn't show up my djvu files

I am trying to print the djvu file names that are currently running on either okular or atril, but when I do lsof | grep ".djvu$" then I am getting no output in the terminal, where the same command ...
1
vote
4answers
261 views

command shuts down too quickly for me to lsof it [duplicate]

Might be idiotic, but I'm running a command that completes very fast, so I don't have enough time to lsof it from another window and see which files is it holding open. Is there some obvious way to ...
1
vote
1answer
160 views

What does lsof -ad3-999 -c rsync do?

I was trying to see the progress of a already running rsync and cp task and found this answer that allowed me to see what was currently happening When i went to the man page for lsof and see that -c ...
0
votes
1answer
128 views

How to list all the processes which have accessed a particular file? [duplicate]

strace can monitor only one single processes not all, lsof is not a good way too, it's not a real time tool, maybe I need a real time version of lsof? How to list all the processes which have accessed ...
0
votes
1answer
589 views

Is it possible to list all files that are opened by a process [duplicate]

I know that lsof can list all files which are being opened by running processes. If there is a process, which will open a file and then will be terminated, I don't think I can catch the file that is ...
1
vote
1answer
235 views

What does “localhost:tram” message means?

I have deployed an application in Glassfish. I see "localhost:tram" in the list of open files : java 30842 user 1589u IPv6 555599352 0t0 TCP localhost:57171->localhost:tram (CLOSE_WAIT) java 30842 ...
2
votes
0answers
428 views

netstat show a listen port but pid don't exist and can't find it with lsof

I am running macOS(0.13.6) and while trying to test tinc, I get a warning that port 0.0.0.0:655 is already in use. This is the output I get from netstat: $ sudo netstat -anv -p udp Active Internet ...
2
votes
1answer
81 views

How to link a tunX interface to a specific OpenVPN instance?

I known that I can give a specific name to the TUN interface using --dev option, but I didn't and I have now on a router machine something like a hundred client configs. with less clients I was able ...
3
votes
1answer
735 views

Find processes which have a file open without lsof or fuser

I'm working on a Linux (Scientific Linux CERN SLC release 6.9 (Carbon)) machine on which I am unable to install programs and on which the lsof or fuser commands are not available. I'm trying to ...
0
votes
0answers
774 views

disk in use in-spite we perform umount and lsof is empty

we want to perform fsck -f on /dev/sdc but without success umount -l /var/hadoop/zookeper lsof /var/hadoop/zookeeper/ fsck -f /dev/sdc fsck from util-linux 2.23.2 e2fsck 1.42.9 ...
2
votes
1answer
719 views

What is the difference between lsof vs lsof -i

One of my processes running on Debian server started throwing a socket: too many open files error. I then started debugging the error. I came through the following scenario. When I ran lsof | grep ...
1
vote
2answers
741 views

Linux memory mapped files

Output of lsof on my RHEL7 shows that one file with file descriptor mem is used by 40 processes. Does it mean that this file is mapped in memory 40 times or what? Could someone please explain what ...