Score:0

How to list disk usage by directory, excluding certain output

cn flag
SEU

I am trying to get a sense of disk usage and I want to exclude the ones I cannot access like this - any suggestions?

sudo du -h / --max-depth=1 | grep -v "cannot access"

Thanks.

Score:1
hr flag

In bash, you can redirect the standard error stream to a process substitution

du -h / --max-depth=1 2> >(grep -v 'cannot access')

This will filter out the cannot access error messages, but retain others such as Permission denied and so on.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.