In Zsh: Is there a way to use ls to only list files and folders in the current directory that match a specific globbing or regex pattern?

For example, say I have multiple files that start with the character #, the following command does not do what I want:

ls -l #*

I know I can do this with find, i.e. find . "#*" -maxdepth 1 -print, but I am looking for a solution that lists files and folders with permissions in ls.

I presume that one way of doing this is by parsing the output of ls (but AFAIK this is usually not recommended).


You seem to be missing the -d option to ls.

ls -ld \#*
  • Thanks, and I guess and I was also missing the escaping character ``! – Amelio Vazquez-Reina Sep 24 '12 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.