Kill process that raises Device or resource busy: '/dev/ttyUSB0'?

You can use

$ fuser /dev/ttyUSB0

to list the PIDs of the processes using the file. Alternatively, if your fuser command supports it you can use the -k option to kill them.


In my case

$ fuser /dev/ttyUSB0

was not working (it showed nothing).

What was working, however, was the following:

$ sudo lsof /dev/ttyUSB0

This gave me a list of the processes that were using my serial port and I could simply kill them using the PID (corresponding to the second column in the list).