How to find all Sun Sat on command line This works on Ubuntu but not on Mac.
$ seq -f %1.0f 20210101 20211231 | date -f - 2&gt;/dev/null | grep 'Sun\|Sat'
...
Sat Dec 18 00:00:00 JST 2021
Sun Dec 19 00:00:00 JST 2021
Sat Dec 25 00:00:00 JST 2021
Sun Dec 26 00:00:00 JST 2021

How to find all Sat and Sun from command line?
The macOS/BSD version of date can't read from standard input so you need to loop manually.
for d in $(seq -f %1.0f 20210101 20211231); do 
    date -jf &quot;%Y%m%d&quot; $d 2&gt;/dev/null | grep 'Sat\|Sun'
done

You can avoid most of the impossible dates created by seq (and get the result faster) by running
for m in {01..12}; do
    for d in {01..31}; do
        date -jf &quot;%Y%m%d&quot; &quot;2021${m}${d}&quot; 2&gt;/dev/null
    done
done | grep 'Sat\|Sun'