fuser command examples
fuser – identify processes using files or sockets
Also see lsof which can be used to identify open files.
fuser -km /home
kills all processes accessing the file system /home in any way.
if fuser -s /dev/ttyS1; then :; else something; fi
invokes something if no other process is using /dev/ttyS1.
fuser telnet/tcp
shows all processes at the (local) TELNET port.