Fuser is a command line utility for the UNIX and LINUX computer operating systems. For many system administrators and other users, Fuser is an invaluable utility because of the control it offers to its users, along with its versatility. There are many different reasons to use Fuser and all of them are worth your time, both as a LINUX and UNIX user and as a system administrator.

The History Of LINUX

The History Of LINUX

First of all, LINUX and UNIX should be explained for neophyte computer users. UNIX and LINUX are related and share some command and utilities(such as Fuser). UNIX came first in 1970 and is a complete operating system. It was originally developed by AT&T and was loaned out to other companies, such as Apple for its Macintosh computers. Unlike LINUX, companies that wish to use UNIX in their products must pay a fee, which can be substantial.

Meanwhile, LINUX is an open source kernel that is based on UNIX, but is considered to be separate in most respects. This means no one company owns LINUX, unlike Windows or DOS, for example. Any individual who wants to add to or modify LINUX may do so without paying a fee or being an employee of a corporation. This flexibility allows for innovations that might be impossible on a closed platform. Although LINUX is open-source, certain companies(such as Valve) still support it. Even though these companies don’t own the OS, they can use it like everyone else does. LINUX isn’t a full operating system yet, but it is very close to being a full OS, and can be used as one in a variety of ways.

How is UNIX different from Windows or Mac OS?

How is UNIX different from Windows or Mac OS

So Fuser is a command-line utility for both UNIX and LINUX. That explains a lot, but if you don’t know what a command line is, these words can still be confusing. With a command line operating system such as UNIX and LINUX, all commands for the operating system must be typed into the computer. An excellent example of a command line OS is MS-DOS. MS-DOS requires the user to type every command. To see a list of files, the user must type “dir”. In order to see a sorted list of files, the user must type in something like “dir /p”. The “/p” portion of the command is known as the parameter, and helps to specify the command that you’re typing into the computer. All computers used to work this way before mouse-based interfaces came into fashion.

But wait a second. There are other operating systems like Windows and Mac OS X that don’t require any typing at all, and are mouse-based. Are those related to these command-line operating systems? The simple answer to that question is yes. Windows and Mac OS X actually create a “shell” of sorts that basically translates the mouse movements you are making into commands on the command line! The command line is even visible in certain instances while you work in Windows or Mac OS X. For example, when you open the “Terminal” window in Mac OS X, you can actually see the UNIX command line and work with it! So most computers still run on a command line, even if computer companies spend a lot of time and energy to make it seem as if that’s not the case.

While most users are content working with their mice in an environment set up by computer manufacturers, some users prefer the control of a command line interface. UNIX is one of the most popular operating systems with this type of interface. Now that we understand what UNIX and LINUX are, we can more fully appreciate what Fuser is and the functionality it gives a knowledgeable user.

What is Fuser and How Does it Work?

What is Fuser and How Does it Work?

With Fuser, you can examine a computer file, see what processes(or running programs) are using the computer file in some way, and actually stop active processes from using a particular file! This ability gives users control over what a program is doing, while the program is working. It’s an exceptional ability to have and is well-worth your time to learn.

To use Fuser, first type the word “Fuser .” into the command line and press enter/return. Please note the period—it is important and tells the computer which directory to examine. The computer will return a series of numbers followed by a letter. According to Tecmint.com, the series of numbers is a PID, or process identification number, which is assigned to each process by the computer as the process is running. The letter that follows the PID is a code that tells the user what file is being executed(running) and which directory the file is in. For example, the letter “e” means that you are looking at an executable file that currently is running. Meanwhile, the letter “c” means that the process is happening to a file in the current directory. This information can be a big help in seeing exactly what’s going on in a network at the moment.

That’s great, but what if you need more information, or you don’t have access to a code key? Well, that isn’t a problem. Simply type “Fuser -v” and a verbose version of the information comes on screen. Fuser shows the name of the current directory, columns of the process owner (USER), the access type (ACCESS) and the command (COMMAND) along with the PID(PROCESS ID) again. This will give you a lot more information to track down exactly what’s going on inside your network. Just identifying the process owner alone could come in very handy. If, for instance, a user on your network inadvertently set up a an endless loop without realizing it, you as the administrator could easily use Fuser to identify the process along with the person responsible. Again, this ability allows a system to be much easier to maintain.

If all Fuser could do was to identify running processes and users, it still would be handy. But Fuser can do far more. As stated above, Fuser can actually stop processes from running. In order to kill all processes affecting a directory, for example, you can type “. Sudo fuser -k”, and then type enter/return. Sudo is a UNIX and LINUX program that grants you administrative access to a UNIX system. It originally stood for “superuser do”. We have already gone over “fuser” and the “-k” parameter stands for “kill”. This command will kill all processes occurring in a particular directory.

Suppose you just want to kill one or two processes? When that happens, simply type in “. Sudo fuser -k -i”. The “-i” parameter stands for “interactive”. When the command is received by the computer, it will ask you if you wish to kill each process, which will be referred to by its PID. It really is that easy and is useful in a number of situations. Take, for example, debugging. If you are aware of which directories/files a program is meant to access, and it keeps crashing, you can use Fuser to check and see if the program is accessing files that it shouldn’t be and whether or not that’s causing the crash.

Real World Examples of How Fuser Can Help With A Problem

man stretching while on work

Another example that is encountered often, in reality, is when a user comes across a file that she may want to delete (because it’s bugged, for example), but a number of processes are using that file, possibly hanging and slowing down the entire system. In that instance, with Fuser, you can just kill every process that is accessing that file and then easily delete it. Without Fuser or another way to stop processes, that file would be difficult to get rid of.

Another instance in which Fuser could come in handy is when you are working on TCP/IP sockets. Fuser can monitor all processes using those sockets by simply typing in “. Fuser n socket name”. So, you can see which programs (processes) are using the Internet at any time, simply by typing in an instruction, and you can stop any unusual or excessive internet traffic. Mobile drives, such as USB drives, can also be monitored this way by typing in the “-m” parameter. Not only is this ability useful for monitoring regular internet traffic, it is also useful for monitoring spyware and virus activity, although admittedly these are uncommon on the UNIX/LINUX platform.

To recap, Fuser is a UNIX and LINUX command line utility that allows you to monitor processes affecting files, as well as network traffic. It also allows you to stop those processes at anytime, simply by typing a command. This way, you, as a system administrator, can accomplish many goals more efficiently, including resource allocation.

Even better, according to digitalocean.com, Fuser allows you to monitor TCP/IP traffic as well, and even allows the same command over mobile drives, such as USB thumbsticks. Fuser is also relatively easy to learn and is available to every computer using LINUX and UNIX. In short, Fuser is a powerful command, and definitely is worth your time to learn.