Questions tagged [lsof]

lsof is a tool to list open files of processes

Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

what is the right way to know all script PIDS that runs under folder

Under the folder /home/testing/scripts on a Linux machine, we have 234 different scripts that do sanity and testing as /home/testing/scripts/test.network.py /home/testing/scripts/test.hw.py /home/...
-4
votes
1answer
45 views

Linux 'lsof' command return large value

I'm using a linux server with tomcat 9.0.24. When I stop the tomcat server, following output will return for 'lsof | wc -l' command fdmt@fdm-3-136 apache-tomcat-9.0.24]$ lsof | wc -l 1203 fdmt@fdm-3-...
0
votes
1answer
17 views

How can I get CentOS to correctly list open ports?

I am working with CentOS 7 OS hosting a set of docker containers. By using a web browser I can reach a service on port 80 and I get back a response. A bit of local knowledge helps me understand that ...
1
vote
0answers
50 views

How can lsof report a higher number than the ulimit?

From time to time some user consumes all the file descriptors (FDs) on a RHEL Linux machine. I have started logging the FDs per user to see the actual state. The logging is run as root to have access ...
0
votes
1answer
33 views

List open files without lsof/fuser at a particular path

On a system that doesn't have lsof or fuser, is it possible to get a list of open files at a particular path? E.g., I'm looking to dismount /volume1 (a software RAID) to run e2fsck and can't, because ...
1
vote
1answer
30 views

Is there an open filename monitor?

Is there a way to list all the files being opened on the system? Either display all the currently opened files (with their full path, probably some lsof option), or, more interesting in my case, just ...
0
votes
1answer
58 views

How can we count/list all files opened by a specific program/COMMAND? [duplicate]

We can list only files opened by a specific PID as lsof -p 1000 lsof -p 1000 | wc -l How can we list/count the files opened by a specific program/COMMAND (e.g., java)? And so much better, if we can ...
0
votes
0answers
138 views

mkfs complain about disk is apparently in use by the system

on our rhel server we want to re-create ext4 filesystem as [root@worker ~]# mkfs.ext4 -j -m 0 /dev/sdd -F mke2fs 1.42.9 (28-Dec-2013) /dev/sdd is apparently in use by the system; will not make a ...
0
votes
0answers
35 views

Process automatically starting on a port in ubuntu 18.04

I have encountered a very weird situation. I am using below command to list all processes running on a particular port 3001: sudo lsof -n -i :3001 Only one process is printed each time and I kill ...
2
votes
1answer
41 views

How to calculate number of open files and number of file descriptors

what are differences between number of open_files and number of file_descriptors in linux ? I'm confused . The value in the /proc/sys/fs/file-max is for total file_descriptors or total open_files ? ...
2
votes
1answer
59 views

is there any way to identify if a file is still being copied from one directory to other

Have a file File.txt and if any process is trying to copy the file from /source/ to /destination/ Is there a way to identify if the file File.txt (or any other file ) available in /destination/ is ...
0
votes
3answers
6k views

lsof command not found in VS Code terminal

I am trying to start up my application with npm start, however I get the following errors: rm: cannot remove 'dist/': Device or resource busy When I try to run an lsof I get the error message: bash: ...
1
vote
2answers
67 views

Get working directory inside SSH client process from outside process

I have SSH'd into a remote machine. I would like to get the current working directory (and ideally execute commands like ls) on that remote machine, but from outside this process. Here are my ...
0
votes
2answers
51 views

How do I get lsof to stop complaining when testing for a socket?

I need to test whether any process is listening on a specific socket; fuser does not exist on the target system but lsof does. I run this command: lsof -tU /path/to/socket It lists the PID of the ...
1
vote
1answer
66 views

How to use lsof to find high activity file writing?

I recently discovered that a buggy program called pcmanfm was writing 200 MB per second to its run.log file, so I had to find ways to combat that. I discovered what file it was that it was writing to ...
0
votes
1answer
59 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
81 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
31 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-...
1
vote
1answer
154 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
490 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
275 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
62 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
91 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
44 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
857 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
71 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 ?...
2
votes
1answer
93 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 ...
2
votes
1answer
380 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
241 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: $ ...
-2
votes
2answers
247 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
139 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
145 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
226 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
2k 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
103 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
157 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
3k 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
259 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
196 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
3k 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
91 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
247 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
2k 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
563 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
231 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 ...
3
votes
1answer
667 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
177 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
109 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
736 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
334 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 ...