this post was submitted on 03 Sep 2025
35 points (100.0% liked)
Linux
58632 readers
490 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Advice from a long time sysadmin: You're probably asking the wrong question. ncdu is an efficient tool, so the right question is why it's taking so long to complete, which is probably an underlying issue with your setup. There are three likely answers:
sudo find $(grep '^/' /etc/fstab | awk '{print $2}') -xdev -type f -exec dirname {} \; | sort | uniq -c | sort -nr | head
explanation
This command doesn't give an exact file count, but it's good enough for our purposes.sudo find # run find as root
$( ... ) # Run this in a subshell - it's the list of mount points we want to search
grep '^/' /etc/fstab # Get the list of non-special local filesystems that the system knows how to mount (ignores many edge-cases)
awk '{print $2}' # We only want the second column - where those filesystems are mounted
-xdev # tell find not to cross filesystem boundaries
-type f # We want to count files
-exec dirname {}; # Ignore the file name, just list the directory once for each file in it
sort|uniq -c # Count how many times each directory is listed (how many files it has)
sort -nr # Order by count descending
head # Only list the top 10 If they are temp files or otherwise not needed, delete them. If they're important, figure out how to break it into subdirectories based on first letter, hash, or whatever other method the software creating them supports.