grep ^\. not working as expected in Mac terminal if I run the following command in my mac terminal:
ls -al | grep ^\. 

or
ls -al | grep '^\.' 

or
ls -al | grep &quot;^\.&quot; 

I get no results back even though there are several files in my home directory that meet this criteria. I tried this in both bash and zsh, and get nothing.
If I run this same command without quotes in Ubuntu, I get the expected results. Can anyone explain why this is?
The grep pattern matches lines that begin with a dot. The output of ls -al has no such lines.
Try ls -a | grep '^\.' and see the difference.