List Open Files
If you try to unmount a partition and get a message like this:
# umount /media/usbdisk/
umount: /media/usbdisk: device is busy
use the lsof command to find out what programs are using what files:
# lsof /media/usbdisk/
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk/
xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk/
This shows that the programs bash and xmms are using the device. For an even clearer picture, use the device name rather than the mountpoint:
# lsof /dev/sdb1
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk
xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk
xmms 6979 root 8r REG 8,17 2713101 377 /media/usbdisk/a.mp3
You either can wait until those processes exit or terminate them manually.
Popular Posts
-
How to block long list of consecutive IP address? How to call linux route command inside a script? How to block consecutive IP address usi...
-
Write small shell script to perform batch conversion. However it works only with files from current directory, and with files what has only ...
-
This article explains how set your PATH variable under Linux. This has the same use as that of setting the PATH variable under DOS. Under Li...
-
du stands for disk usage. This simple linux command provides a summary of harddisk or storage space disk usage. It has many parameter argume...
-
Using imagemagick imagemagick is a collection of tools and libraries for image manipulation. Most distribustions come with imagemagick . ...
-
MooLux is a Live USB Linux distribution based on Slackware that utilizes the KDE desktop environment. MooLux is a portable operating sys...
-
The bash shell maintains a history of the commands you entered. You can re-execute a command by recalling it from the history, without havin...
-
grep is by far the most popular command that exists in Unix. Though some may argue about that, but once you begin using grep, it would alway...
-
If you use Mozilla Thunderbird with KDE you already know that by default Thunderbird open hyperlinks in konqueror . If konqueror your main...
-
It is good to know that it's possible to play those classicNintendo NES games on any Android device with physical keyboard (Motorola Bac...