I wanted to list the content of a pwd and display only file starting with dot.
I tried ls -a | grep ^\. but I cannot figure out why the output contains also the files which do not start with dot. For example:
Pictures
.pip
.pki
.profile
projects
Public
I know that I can achieve what I want with ls -ld .* I am just curious about this behaviour of grep which I can't explain.
ls -d .*to list all files starting with.? – Barmar Apr 08 '15 at 21:40