if [ $# -gt 0 ]; then
PROC=$(fuser -m $1)
for var in $PROC; do
sudo kill -9 $var
sudo umount $1 || echo "Failed to unmount $1"
I saved the file as kumount (lets call it - Killer umount) in /bin.
Make it executable.
chmod a+x /bin/kumount
Now just test it.
I plugged in my audio player, started playing some music in Audacious. Ran the command
... and bang! Audacious got killed and the device unmounted.
Of course, this has many downsides.. Especially when you're copying stuff to a device but I'm sure nobody would kill-unmount devices when they're actually in use ;-)