- Posted on
- • Command Line Interface
How to identify and locate large files and folders
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
When it happens that your VPS is eating data by the second and there is disk read/write issues one port of call you are bound to visit is searching and identifying large files on your system.
Now, you would have been forgiven for thinking this is a complicated procedure considering some Linux Bash solutions for fairly simple things, but no. Linux Bash wins again!
du -sh /path/to/folder/* | sort -rh
Here, du
is getting the sizes and sort
is organising them, -h
is telling du
to display human-readable format.
The output should be something like this:
2.3T /path/to/directory
1.8T /path/to/other
It does take a while to organise as it is being done recursively however given 3-5mins and most scenarios will be fine.
Further Reading
For further reading on managing disk space and handling large files in Linux, consider the following resources:
Finding Large Files with 'find' Command Tutorial:
- URL: https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/
- A comprehensive guide on using the 'find' command to locate large files and directories on a Linux system.
Advanced Guide to 'du' Command:
- URL: https://linuxize.com/post/how-to-check-disk-space-in-linux-using-du-command/
- Provides an in-depth tutorial on various options and uses of the 'du' command for disk usage analysis.
Linux Disk Cleanup Tools Review:
- URL: https://www.cyberciti.biz/faq/linux-check-disk-space-command/
- Reviews various disk cleanup tools available for Linux, which helps in managing disk space effectively.
Sorting Files Efficiently in the Terminal:
- URL: https://www.howtogeek.com/451091/how-to-sort-ls-command-output/
- Focuses on sorting files using terminal commands, enhancing file management practices.
Mastering Linux File System Notifications:
- URL: https://www.linuxjournal.com/content/linux-filesystem-events-inotify
- Discusses how to use the Linux inotify feature to monitor file system changes effectively, which is crucial when managing large files and active directories.