Merhaba, sunucuda bir çok dosya ya da web projesi barındırıyorsanız temizlik için en çok dosyanın hangi klasörde olduğunu merak edebilirsiniz.
Bunun için sizlere bir bash script hazırladım. Kullanımı gayet basit
Aşağıda yer alan komutları bir bash scripti bir dosyaya yazın , örneğin: nano nerede.sh , içeriği sağ tuş ile yapıştırdıktan sonra, ctrl +x ile kaydedin
chmod +x inode.sh yazarak dosyaya çalıştırma izinini verin ve ardından ./nerede.sh /home komutunu uygulayarak kullanabilirsiniz.
linux hosting
uygulanacak komut
#!/bin/bash
if [ $# -ne 1 ];then
echo "Usage: `basename $0` DIRECTORY"
exit 1
fi
echo "Lutfen sonucu gormek icin biraz bekleyin... Bora Arat..."
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
#!/bin/bash
if [ $# -ne 1 ];then
echo "Usage: `basename $0` DIRECTORY"
exit 1
fi
linux web hosting
echo "Lutfen sonucu gormek icin biraz bekleyin... Bora Arat..."
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
Çıktı alttaki gibi olacaktır.
1. 9679 files in: /home/nedemek/public_html/wp-content/uploads4
2. 1201 files in: /home/cpeasyapache/src/php-5.4.45/Zend/tests
3. 1172 files in: /home/faydalari/mail/cur
4. 1125 files in: /home/örneksite/public_html/wp-content/uploads/2016/01
5. 881 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/array
6. 875 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/strings
7. 801 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/file
8. 731 files in: /home/örneksite/mail/new
9. 708 files in: /home/örneksite/public_html/wp-content/themes/steadyincome/options/google-typography/images/fonts/png
10. 640 files in: /home/örneksite/src/php-5.4.45/ext/spl/tests
1. 9679 files in: /home/nedemek/public_html/wp-content/uploads4
2. 1201 files in: /home/cpeasyapache/src/php-5.4.45/Zend/tests
3. 1172 files in: /home/faydalari/mail/cur
4. 1125 files in: /home/örneksite/public_html/wp-content/uploads/2016/01
5. 881 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/array
6. 875 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/strings
7. 801 files in: /home/örneksite/src/php-5.4.45/ext/standard/tests/file
8. 731 files in: /home/örneksite/mail/new
9. 708 files in: /home/örneksite/public_html/wp-content/themes/steadyincome/options/google-typography/images/fonts/png
10. 640 files in: /home/örneksite/src/php-5.4.45/ext/spl/tests