Interview Questions/Phone Screen/Find Large Files with Bash
BeginnerPhone
1 min

Find Large Files with Bash

LinuxScriptingTroubleshooting
Advertisement
Interview Question

Which command would you use to find the largest files/directories consuming disk space in a path?

Key Points to Cover
  • `du -sh * | sort -h` to summarize and sort by size
  • `du -ah /path | sort -h | tail` for top offenders
  • Optionally use `ncdu` for interactive exploration
Evaluation Rubric
Provides correct du usage50% weight
Sorts human-readable sizes25% weight
Mentions ncdu or alternatives25% weight
Hints
  • 💡Remember `-x` to stay on one filesystem if needed.
Potential Follow-up Questions
  • How to exclude directories?
  • How to check inode usage?
Advertisement