Inode Usage Issue

  • Find out the large files for inode usage:
    for ii in $(find -maxdepth 1 -type d); do echo -e “${ii}\t$(find “${ii}” -type l -o -type d -o -type f | wc -l)”; done | sort -n -k 2 | column -t
  • Look for biggest directories in the current working directory:

    du -skh — * | sort -n

    du -a | sort -n -r | head -n 5

    du -hsx * | sort -rh | head -10 (Best)

    du -a /var | sort -n -r | head -n 10 (in /var folder)

    Let us break down the command and see what says each parameter.
    1. du command: Estimate file space usage.
    2. a : Displays all files and folders.
    3. sort command : Sort lines of text files.
    4. -n : Compare according to string numerical value.
    5. -r : Reverse the result of comparisons.
    6. head : Output the first part of files.
    7. -n : Print the first ‘n’ lines. (In our case, We displayed first 5 lines).
  • List top 10 Inodes files/folders:for i in `ls -1A | grep -v “\.\./” | grep -v “\./”`; do echo “`find $i | sort -u | wc -l` $i”; done | sort -rn | head -10
  • Remove all files from a folder:rm -rf folder/*
Scroll to top