How to find who occupied disk space

How to find who occupied disk space

 

  1. du -h -x --max-depth=1 # x: skip directories on different file systems
  2. lsof # if file was deleted, but still opened.
    • lsof | grep '(deleted)' | sort | uniq
    • COMMAND     PID   TID           USER   FD      TYPE             DEVICE    SIZE/OFF       NODE NAME
  3. how to undelete a file
    • cp /proc/pid/fd/fd_no file
  4. how to find the info about a process
    • ls -l /proc/PID
    • cwd符號鏈接的是進程運行目錄;
    • exe符號連接就是執行程序的絕對路徑;
    • cmdline就是程序運行時輸入的命令行命令;
    • environ記錄了進程運行時的環境變量;
    • fd目錄下是進程打開或使用的文件的符號連接。

How To Check Environment Variables for a Running Process

  1. LINUX :  strings –a /proc/<pid_of_the_process>/environ
  2. Solaris  pargs -e <pid_of_the_process>
  3. AIX  pargs or ps eww <pid_of_the_process>
發佈了358 篇原創文章 · 獲贊 41 · 訪問量 43萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章