Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamesstacyjones/c70e38c69eca0806305e5426f9140907 to your computer and use it in GitHub Desktop.
Save jamesstacyjones/c70e38c69eca0806305e5426f9140907 to your computer and use it in GitHub Desktop.
Command line to find large files in linux
Find top 20 largest files starting at root directory
du --exclude=/proc* -a / | sort -n -r | head -n 20
List the size of of the folders in the current directory
du -hsx * | sort -rh | head -10
Checks processes that are keeping deleted files open
lsof -s | grep deleted | sort -k 8
Check rotation of error logs ... as it is not working large files are being created
logrotate -d /etc/logrotate.conf
Cool check that will give the totals of each folder in the root directory as well as the total space being used by the server.
.. if not being used there then it is probably a process maybe using a deleted file
du -x -d1 -h /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment