Write a script that finds the 10 largest files under / without crossing into other filesystems.

IntermediateHands-onBash scripting tasks
Answer
find / -xdev -type f -size +100M -printf '%s %p\n' 2>/dev/null | sort -rn | head -10 \
  | awk '{printf "%.1f MB %s\n", $1/1048576, $2}'

Key trick → -xdev keeps find off /proc, NFS mounts and other volumes. -printf '%s' gives bytes for exact sorting.

All Real-World Interview questions Roadmap: Interview readiness

More on Bash scripting tasks