Questions tagged [fuser]

fuser is a tool used to identify processes based on the files they're using (eg. regular file, socket, network connection, ...).

fuser can identify and signal processes which are using a specific (set of) resource(s), such as:

  • A file
  • A socket
  • A network connection (TCP/UDP sockets).
  • A file system
  • A device

The man page (fuser(1)) provides some examples:

# Kill all processes accessing the filesystem mounted at /home.
fuser -km /home

# Execute something is a process is using /dev/ttyS1.
fuser -s /dev/ttyS1 && ...

# Show all processes using the telnet port for TCP exchanges.
fuser telnet/tcp

See the man page for a complete list of options, features, and restrictions.

28 questions
7
votes
2 answers

fuser vs lsof to check files in use

I've been getting some suggestions on how to figure out why my serial port is busy. Specifically, when I try to start gammu-smsd, it refuses to start on /dev/ttyS0 because it says that port is busy: sudo /etc/init.d/gammu-smsd start Sep 30 16:16:51…
JohnMerlino
  • 5,941
  • 11
  • 34
  • 38
6
votes
1 answer

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 filename or fuser filename will do the work. But…
dr_
  • 28,763
  • 21
  • 89
  • 133
6
votes
2 answers

List current inotify watches (pathname, PID)

How do I get a list of: Pathnames currently being watched by inotify, and PID of the process watching I ask because I have found that syncthing's inotify watches were preventing my disk from being unmounted. As can be seen below, nothing appears…
Tom Hale
  • 28,728
  • 32
  • 139
  • 229
4
votes
1 answer

umount failed: device busy

I have a folder in /tmp that is mounted as ramfs. After some action that my script does, I delete everything inside said folder with the command: rm -R -f "$tmp_dir"/{*,.*} Then, I try to unmount the directory, but on the first try it doesn't work…
Dor
  • 2,445
  • 7
  • 33
  • 32
4
votes
1 answer

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 remove an NFS dotfile on this machine but I keep…
Peter
  • 195
  • 8
3
votes
2 answers

How can I find out what is holding a file or mount point, when `fuser` shows nothing?

I have a laptop that refuses to suspend. On the latest Ubuntu, the only way I can turn it off is to hold down the power button. The reason is because I have an nfs share that has gone offline, and something is still trying to commit data to it. I…
Dagelf
  • 266
  • 3
  • 8
3
votes
1 answer

kill processes shown by sudo fuser filtered by COMMAND column

using the following line I have been able to see processes that use the GPU some of which are mentioned python under the COMMAND column. sudo fuser -v /dev/nvidia* which prints: USER PID ACCESS COMMAND /dev/nvidia0: …
Alejandro
  • 133
  • 1
  • 5
3
votes
1 answer

How to ensure all processes are killed before unmounting a filesystem?

I am trying to unmount a busy file system on which continuous I/O reads and writes are happening by a multithreaded program due to which the umount command fails. root@ubuntu:~ # umount /mount/v1 umount: /mount/v1: target is busy. (In some…
3
votes
3 answers

find pid of open tcp port, as a regular user

From local host I'm ssh tunneling some remote host:port to my local host:port, so anybody on a remote host can use their "local" port to access my port via that tunnel. I'm using some regular (non-root) user account on both hosts for this. For…
Goran
  • 31
  • 2
3
votes
1 answer

Do a command in all open shells

I use sshfs to do useful things on my dev box. I love it. But, I usually forget to fusermount -u before I close my lid (triggering hibernate). Then, when I come back, sshfs is frozen and I have to clean up. I'd much rather have a script in…
Rob Kinyon
  • 141
  • 3
2
votes
2 answers

SSHFS Error: "Bad SSH2 cipher spec 'arcfour'" & "read: Connection reset by peer"

Hellow world! So I've started developing a project that will run on rPi-3B+. I've run into a problem with SSHFS. Right now I'd really like to be able to edit, and commit, the git repo stored on the Pi from my text editor, atom, on my laptop over…
AustinFoss
  • 131
  • 2
  • 5
2
votes
1 answer

How do I figure out what is preventing a bind mount from unmounting?

I have a problem with a mountpoint being too busy to unmount. Normally, lsof or fuser would tell me what process is using it, but this is a bind mount, so lsof and fuser show what is using both the original mountpoint, and the bind…
Tal
  • 1,982
  • 5
  • 22
  • 36
1
vote
1 answer

Find number of process running using fuser

We are using fuse to find the logs associated to particular port. fuser /test/log* This results in a list of logs associated with port How to find the number of lines on the output? I tried with |wc - l no luck.
Varja
  • 69
  • 1
  • 8
1
vote
0 answers

Using the fuser command to kill processes using a mount point is taking a long time

I am trying to kill processes with open file handles on a mount point before performing unmount. We observed for a few mount points, the below fuser command is taking a long time. It took more than 3 minutes and still it didn't finish. We haven't…
Bharath
  • 11
  • 2
1
vote
1 answer

wget -i notifying when each file finishes (for processing purposes)

I'd like to be able to process multiple files downloaded by wget -i immediately after they are downloaded (instead of waiting for all files in the list to finish--for the entire wget process to exit). The trouble is: because wget downloads the file…
Bailey Parker
  • 310
  • 1
  • 2
  • 11
1
2