ajout script max inode
This commit is contained in:
parent
cfba23391b
commit
a5af1d5d72
14
TipsShell.md
14
TipsShell.md
|
@ -175,4 +175,18 @@ $ lsof -Pan -p PID -i
|
|||
|
||||
~~~{.bash}
|
||||
$ lsof -i :Port
|
||||
~~~
|
||||
|
||||
## Lister les répertoires ayant le plus de fichiers <=> max inode
|
||||
|
||||
|
||||
~~~{.bash}
|
||||
PATH_TO_WATCH='/var'
|
||||
RESULT_FILE='list_max_inode.txt'
|
||||
TMP=$(mktemp)
|
||||
#Regarder dans le premier niveau
|
||||
(for i in $(find $PATH_TO_WATCH -type d); do echo $(ls -a $i | wc -l) $i; done) | sort -n > $TMP
|
||||
#compter dans les sous niveaux
|
||||
cat $TMP | (while read line; do num=$(echo $line | awk '{ print $1 }'); path=$(echo $line | awk '{ print $2 }'); echo ${path%/*}; done) | sort | uniq | (while read line; do echo $(grep "$line" $TMP | cut -f1 -d' ' | xargs echo -n | tr -s ' ' '+' | xargs echo | bc -l) $line; done) | sort -n | tee $RESULT_FILE
|
||||
rm $TMP
|
||||
~~~
|
Loading…
Reference in New Issue