Linux’te en çok dosya barındıran 10 klasörün tespiti (inode)

Aşağıdaki bash scripti kullanabiliriz.

Kullanımı aşağıdaki bash scripti bir dosyaya yazın , örneğin   nano inode.sh  , içeriği yapıştırın , ctrl +x ile kaydedin , chmod +x inode.sh ile çalıştırma izni verin , sonra ./inode.sh /home şeklinde kullanabilirsiniz.

#!/bin/bash
 
if [ $# -ne 1 ];then
  echo "Usage: `basename $0` DIRECTORY"
  exit 1
fi
 
echo "Lutfen sonucu gormek icin biraz bekleyin... Ayhan ARDA..."
 
find "$@" -type d -print0 2>/dev/null | while IFS= read -r -d '' file; do 
    echo -e `ls -A "$file" 2>/dev/null | wc -l` "files in:\t $file"
done | sort -nr | head | awk '{print NR".", "\t", $0}'
 
exit 0

 

Sonuç aşağıdaki gibi gözükecektir.

root@ayhanarda:~# ./inode-arda.sh /home
Lutfen sonucu gormek icin biraz bekleyin… Ayhan ARDA…
1. 18507 files in: /home/orneksite/httpdocs/resimler/urun
2. 9370 files in: /home/orneksite2/httpdocs/images/resimler201203
3. 8729 files in: /home/orneksite3/httpdocs/urunler
4. 4828 files in: /home/orneksite4/httpdocs/wp-content/uploads
5. 4699 files in: /home/orneksite5/httpdocs/testi/images
6. 3162 files in: /home/orneksite6/httpdocs/Galeri/Foto
7. 2715 files in: /home/orneksite7/httpdocs/media/k2/users
8. 2250 files in: /home/orneksite8/httpdocs/deneme/par
9. 2230 files in: /home/orneksite9/tmp
10. 2039 files in: /home/orneksite10/tmp

 

Ayhan ARDA

Share Button

Yayımlandı

kategorisi

, ,

yazarı:

Yorumlar

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

This site uses Akismet to reduce spam. Learn how your comment data is processed.