×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔÚLinuxϵͳÖÐ £¬Ã»ÓÐdufÏÂÁîʱ £¬ÔõÑù¿ìËÙÅÌÎÊ´ÅÅÌ¿Õ¼äʹÓÃÇéÐΣ¿

ÔÚLinuxϵͳÖÐ £¬Ê¹Óà du ÏÂÁîÊÇÒ»ÖÖ³£¼ûµÄÒªÁìÀ´Éó²é´ÅÅÌ¿Õ¼äʹÓÃÇéÐΡ£¿ÉÊÇ £¬ÔÚijЩÇéÐÎÏ £¬¿ÉÄÜ»áÓöµ½Ã»ÓÐ du ÏÂÁîµÄÇéÐÎ £¬ÄÇôÎÒÃÇ¿ÉÒÔͨ¹ýÆäËû·½·¨À´¿ìËÙÉó²é´ÅÅÌ¿Õ¼äʹÓÃÇéÐΡ£±¾ÎĽ«ÏÈÈÝһЩÌæ»»¼Æ»® £¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£

ʹÓà df ÏÂÁî

df ÏÂÁî¿ÉÒÔÏÔʾÎļþϵͳµÄ´ÅÅÌ¿Õ¼äʹÓÃÇéÐΡ£Í¨¹ý df ÏÂÁî £¬ÎÒÃÇ¿ÉÒÔ¿ìËÙÉó²éÿ¸ö¹ÒÔصãµÄ¿Õ¼äʹÓÃÇéÐΡ£

ʾÀý´úÂ룺

df -h

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÏÂÁÒÔÈËÀà¿É¶ÁµÄ·½·¨ÏÔʾ´ÅÅÌ¿Õ¼äʹÓÃÇéÐÎ £¬°üÀ¨Îļþϵͳ¡¢ÈÝÁ¿¡¢ÒÑÓÿռ䡢¿ÉÓÿռäºÍ¹ÒÔصãµÈÐÅÏ¢¡£

ʹÓà ncdu ÏÂÁî

ncdu ÊÇÒ»¸öÕë¶Ô´ÅÅÌ¿Õ¼äÕ¼ÓÃÇéÐεĽ»»¥Ê½¹¤¾ß £¬¿ÉÒÔ×ÊÖúÓû§¿ìËÙÉó²é²î±ðĿ¼ºÍÎļþµÄ¿Õ¼äÕ¼ÓÃÇéÐΡ£

ʾÀý´úÂ룺

# ×°ÖÃ ncdu
sudo apt install ncdu

# ÔËÐÐ ncdu
ncdu

µÇ¼ºó¸´ÖÆ

ͨ¹ýÒÔÉÏ´úÂëʾÀý×°Öò¢ÔËÐÐ ncdu £¬Äú¿ÉÒÔ½»»¥Ê½µØä¯ÀÀÎļþϵͳ²¢Éó²éÿ¸öĿ¼µÄ¿Õ¼äʹÓÃÇéÐΡ£

ʹÓà du ÏÂÁîµÄÌæ»»ÒªÁì

ÈôÊÇûÓÐ du ÏÂÁî £¬Ò²¿ÉÒÔͨ¹ýÆäËû·½·¨ÊµÏÖÀàËƵĹ¦Ð§¡£ÏÂÃæÊÇÒ»¸öʾÀý¾ç±¾ £¬¿ÉÒÔÓÃÓÚÅÌËãÖ¸¶¨Ä¿Â¼µÄ×Ü¿Õ¼äʹÓÃÇéÐΣº

#!/bin/bash

total=0

function calculate_size {
    for item in $(ls $1)
    do 
        if [ -d $1/$item ]; then
            calculate_size $1/$item
        else
            size=$(stat -c %s $1/$item 2>/dev/null)
            let total+=size
        fi
    done
}

calculate_size "/path/to/directory"

echo "Total space used: $total bytes"

µÇ¼ºó¸´ÖÆ

Äú¿ÉÒÔ½«ÒÔÉÏ´úÂëÉúÑÄΪһ¸ö¾ç±¾Îļþ £¬²¢½« “/path/to/directory” Ì滻ΪÄúҪͳ¼Æ¿Õ¼äʹÓÃÇéÐεÄĿ¼¡£ÔËÐо籾ºó £¬½«Êä³ö¸ÃĿ¼ÏÂËùÓÐÎļþµÄ×Ü¿Õ¼äʹÓÃÇéÐΡ£

×ÜÖ® £¬ËäȻûÓÐ du ÏÂÁî¿ÉÄÜ»áÈÃÎÒÃǸÐÓ¦ÒÉÐÄ £¬¿ÉÊÇͨ¹ý df ÏÂÁî¡¢ncdu ¹¤¾ß»ò×Ô½ç˵¾ç±¾ £¬ÎÒÃÇÈÔÈ»¿ÉÒÔ¿ìËÙ¶ø׼ȷµØÉó²é´ÅÅÌ¿Õ¼äµÄʹÓÃÇéÐΡ£

ÒÔÉϾÍÊÇÔÚLinuxϵͳÖÐ £¬Ã»ÓÐdufÏÂÁîʱ £¬ÔõÑù¿ìËÙÅÌÎÊ´ÅÅÌ¿Õ¼äʹÓÃÇéÐΣ¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ