How to check for open files in linux

This is useful to find out which file is blocking a partition which has to be unmounted and gives a typical error of:

# umount /home/
umount: unmount of /home failed: Device busy

  umount impossible because a file is locking home

Find opened files on a mount point with fuser or lsof:

# fuser -m /home   # List processes accessing /home

# lsof /home/ctechz/

About an application:
# lsof -p 3324 

About a single file:
# lsof /usr/local/src/firefox/firefox

FreeBSD and most Unixes

# fstat -f /home  # for a mount point
# fstat -p PID    # for an application with PID
# fstat -u user   # for a user name


To list all the open files on the var filesystem:
# lsof +D /var

To list all open files in your current directory only:
# lsof +d .

To list all open Internet files:
# lsof -i

To list all files currently open by user joe:
# lsof -u jake

 To list all files open by syslog-ng (this is a great quick way to find logs!):
# lsof -c syslog

To list all files open by pid:
# lsof -p PID

List sockets related to port 80
# lsof -i :80

Terima kasih telah membaca artikel tentang How to check for open files in linux di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.

Artikel terbaru :

  • How To Install Cinnamon In Ubuntu 14.04
  • How To Install Mate Desktop In Ubuntu 14.04
  • Creating the first Windows Server 2003 Domain Controller in a domain
  • How To Install Ubuntu 13.10 Server
  • How to Install Nuvola Player in Ubuntu
  • How to establish Emerald in Ubuntu 13.10 & Linux Mint 16
  • How to Restoring iptables Automatically On Boot on Debian and Ubuntu
  • How to Compile FFMPEG with H.264 and LAME in Ubuntu And Debian
  • How to Install Linux on a Playstation 2
  • apt-fast: Improve apt-get Download Speed
  • Artikel terkait :