Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A How to find big files and directories?

I agree with other answers: Normal TUI way is ncdu Normal CLI way is du Normal GUI way is Baobab aka "Gnome Disk Usage Analyzer" and the like But just for fun, you can build a pipeline such...

posted 2mo ago by matthewsnyder‭

Answer
#1: Initial revision by user avatar matthewsnyder‭ · 2024-10-05T18:46:17Z (about 2 months ago)
I agree with other answers:

* Normal TUI way is `ncdu`
* Normal CLI way is `du`
* Normal GUI way is Baobab aka "Gnome Disk Usage Analyzer" and the like

But just for fun, you can build a pipeline such as the one below, which finds all files, then uses `stat` to query their size and `parallel` to parallelize it, and finally `sort` and `tail` to print the best one.

```
$ fd | pv | parallel 'echo $(stat -c %s {}) {}' | sort -h | tail -n 10
```

The performance of this is iffy, so I added pv for some progress info. pv doesn't know how many files there are until fd is done enumerating them, so it won't give % progress, only how much is done. You can convert byte sizes to human size with `cut` and `numfmt`.

This does give you more control over the specifics, such as if you want to look at only a certain subset of files. You can do that with `du` as well, but this way you get to use more familiar generic tools rather than `du`s specialized syntax.