Skip to content

Instantly share code, notes, and snippets.

@sprobejames
Last active January 26, 2024 07:26
Show Gist options
  • Select an option

  • Save sprobejames/5bd9111f840edd1df579b88f4d028f64 to your computer and use it in GitHub Desktop.

Select an option

Save sprobejames/5bd9111f840edd1df579b88f4d028f64 to your computer and use it in GitHub Desktop.
Linux find largest file in directory recursively
# @see https://www.cyberciti.biz/faq/linux-find-largest-file-in-directory-recursively-using-find-du/
# Linux find a biggest files in /
sudo du -a /dir/ | sort -n -r | head -n 20
sudo du -a / 2>/dev/null | sort -n -r | head -n 20
# Linux find large files quickly with bash alias
## shell alias ##
alias ducks='du -cks * | sort -rn | head'
### run it ###
ducks
# Finding largest file recursively on Linux bash shell using find
sudo find / -type f -printf "%s\t%p\n" | sort -n | tail -1
find $HOME -type f -printf '%s %p\n' | sort -nr | head -10
# @see https://www.tomshardware.com/how-to/find-large-files-linux
# Search all filesystems for files larger than 100MB.
sudo find / -type f -size +100M
# Finding the 10 Largest Linux Files on Your Drive
sudo du -aBm / 2>/dev/null | sort -nr | head -n 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment