How to make use of fuser command in Linux

5

Files or directories in Linux are being accessed via processes of a singular identification. If we wish to carry out any motion at the particular procedure this is having access to a particular report or listing, we should know concerning the procedure identification of that exact procedure. In this write-up, we’re going to provide an explanation for the usage of the fuser command in Linux with the assistance of some examples.

What is the fuser command in Linux

There are other instructions utilized in Linux to regulate the networking and tracking the processes, amongst them one very helpful command is the fuser command, which is used to determine the processes being utilized by the report, directories, or sockets which can be discussed within the command done. We can to find out the main points of the fuser command both via having access to its guide or operating the “fuser” command within the terminal. To open the guide of fuser, run the command:

Or the usage of the fuser command:

In the above output, we will be able to see that it generates the feedback of “No process specification given” as a result of we’ve got now not enter the main points of any procedure and defined the use of the fuser command. To show the method main points having access to the present operating listing:

In the above command, “.” is used to determine the method main points of the current listing, it has displayed the “USER” identify, PID of the method, ACCESS (c stand for the present listing), and COMMAND method which is the usage of the method. We too can show the processes used to open and run the textual content report, for instance, we’ve got a textual content report with the identify, mytestfile1.txt:

$ fuser -v -m mytestfile1.txt

In the above command, the “-m” flag (m indicates mount) is used to determine the processes of the filesystem which can be having access to the report, mytestfile.txt. This flag may be very helpful to determine the processes having access to any explicit report so we will be able to kill it. We can kill the method the usage of the fuser command, for instance, we wish to kill the entire processes, we use the “-k” flag, and for all processes, use “.”:

It will kill the entire processes of the house listing together with the method which is operating the running gadget and the running gadget can be close down so be wary, and if you need that the gadget will ask you for killing each procedure or now not, use the “-i” flag with “-k”:

In the above output, first, it’ll show the entire processes which can be being utilized by the house listing then it asks the consumer to delete or now not each procedure. Also, there are lots of different alerts which can be utilized with the fuser command. To checklist down the entire alerts, use the command:

Conclusion

Every report or command in Linux makes use of some processes of the gadget. If we wish to know which processes are the usage of which recordsdata, sockets, and instructions we use the fuser command. We too can kill the processes via figuring out the method with the fuser command and the “-k” flag is used to kill the method. In this writeup, we’ve got mentioned the usage of the fuser command intimately and in addition provide an explanation for other flags which can be utilized with the fuser command.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More