grep -v or grep --invert-match doesn't work on Big Sur
grep
is not broken per-se in macOS Big Sur.
The output you are seeing is stderr
output from the du
command and it is a separate stream from stdout
that is being being piped to grep
.
Use du -h -d 1 2>/dev/null
instead, or use du -h -d 1 2>&1 | grep -v 'not permitted'
, however, I'd use the former instead in this particular use case.
Have a look at Standard streams as a reference on standard input (stdin
), standard output (stdout
) and standard error (stderr
).