Questions tagged [fuser]

32 questions
1
vote
2 answers

fuser equivalent in Powershell?

I want to delete a directory, but a process is using it. mv : Access to the path 'C:\Users\mike\Documents\myapp\node_modules\' is denied. Explorer mentions the dir is in use. Is there a Windows Powershell equivalent of fuser? Note this is a…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
1
vote
4 answers

how to check if Linux symlink is in use? (removing unused symlink)

fuser can show you ONLY if original file is in use. fuser DOESN'T SHOW YOU IF SYMLINK IS IN USE which calls original file. That's the issue. You don't know if symlink unused and can be removed. I have started two processes (24261 opened original…
laimison
  • 1,409
  • 3
  • 17
  • 39
1
vote
1 answer

fuser bash script returning unanticipated output

#!/bin/bash fuser /mount/foo echo $? if [ $? = 0 ]; then echo "There are no processes accessing foo." else echo "foo is in use." Echo$? is returning '1' because the fuser process is accessing the mount - rather than echoing "The mount is…
user328721
  • 13
  • 3
1
vote
1 answer

gedit use of file not showing in fuser

I have started using the fuser command and it looks very useful. It seems to work well. However I noticed a little anomaly which is that if I open a file with gedit fuser doesn't tell me that gedit has accessed that file. It shows all the other…
Mustafa Doe
  • 125
  • 1
  • 2
  • 7
0
votes
0 answers

How to find process of .nfs files in directories and kill all

I am trying to delete a folder named sim_build but I am not able because there are several .nfs* files in the sim_build (and also within the subfolders) that are busy/unclosed. I currently find the .nfs* files within directories manually using fuser…
M.X
  • 195
  • 3
  • 12
0
votes
1 answer

fuser command output process ID extraction

Try to extract the process ID that is using a given port number from the fuser output as below $ fuser 9092/tcp 9092/tcp: 5920 Extracting the PID using awk is not happening $ fuser 9092/tcp | awk -F: '{print $2}' 9092/tcp: from the…
Ibrahim Quraish
  • 3,889
  • 2
  • 31
  • 39
0
votes
1 answer

Avoid bash command output to logged

I'm searching for a way to avoid that some bash command executed from within a Node-Red process (running on my Raspberry Pi 3B+ device) will go into the /var/log/system log file of the Raspeberry OS (Stretch). In particular I've got a node (within …
0
votes
2 answers

Replace file only if not being accessed in bash

My requirement is to replace file only when it is not being accessed. I have following snippet: if [ -f file ] then while true do if [ -n "$(fuser "file")" ] then echo "file is in use..." else echo…
user1228352
  • 569
  • 6
  • 21
0
votes
1 answer

Unix how to store fuser command output to a variable

I'm a newbie in scripting and I have this problem: I want to use the fuser command to check if a file with that name is present. I want to save the output of the command and later use it to rename the file before loading. I have tried the…
user8592197
  • 77
  • 10
0
votes
1 answer

fuser command in centos print an unwanted output in bash script

I'm using centOS 7, and I'm trying to check what is the pid of a process using port X/tcp with "fuser" command, through a bash script, like so: some_pid=$(fuser X/tcp) > /dev/null another_pid=$(fuser Y/tcp) > /dev/null ... if [[ -z…
mizenetofa1989
  • 117
  • 2
  • 16
0
votes
1 answer

how does fuser report on sockets as non-root user?

I'm trying to use fuser to find the pids of processes I own which have certain TCP ports open. In the fuser man page it says: ... The most common time this problem occurs is when looking for TCP or UDP sockets when running fuser as a non-root user.…
perlman
  • 139
  • 4
0
votes
1 answer

Count how many processes hold a file on a linux system

I am intersted to know how many processes or any other entity whatsover, holds a specific file on the system. I tried to find a way using lsof (I don't want to aggregate all the holders for effectiveness reasons), but couldn't find anything in the…
Eytan Naim
  • 159
  • 14
0
votes
0 answers

How to redirect the output of fuser to a file?

I'm using fuser with options -uv and I'm getting following output: $fuser -uv ~/sh/test_script.sh USER PID ACCESS COMMAND /home/abc/sh/test_script.sh: abc 3501 f....…
ani627
  • 5,578
  • 8
  • 39
  • 45
0
votes
1 answer

fuser alternative? i want to know all processes accessing a file

I asked a question about the fuser command yesterday here. It seems gedit (and other text editors, and perhaps even other processes) act a bit differently in the way they interact with files, so they don't show up on when calling fuser even though…
Mustafa Doe
  • 125
  • 1
  • 2
  • 7
0
votes
2 answers

Shell Script for Killing PID

I run a few processes that I created myself on my Ubuntu Server, and to kill them I run: sudo fuser -n tcp PORT kill -9 PID-DISPLAYED Is there any way I can obtain the PID from a port using a shell script, then kill it by running the shell…
Austin K
  • 539
  • 2
  • 5
  • 13