O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

fuser

Format:

fuser options file 

Options:

-k kill all processes on file or file system
-u show all processes on file or file system

The fuser command is used to show processes that are running on a file system or files that are being accessed. Some systems use -u and -m interchangeably. You can use the if command statement with the fuser command.

To list processes active on the device /dev/hda5:

					$ fuser -m /dev/hda5 
/dev/hda5: 1 1r 1c 1e 37 37r 37c 37e 144 
   144r 144c 144e 158 158r 158c 158e 167r 167c 
167e 178 17 8r 178c 178e 189 189r 189c
				

To kill all processes on the device /dev/hda5:

					$ fuser -k /dev/hda5
				

To see if the file doc_part is open and what processes are running on it:

					r$ fuser -m /root/doc_part /root/dt: 1 1r 1c 1e 37 37r 37c ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required