Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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).

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

ls -ld \#*
share|improve this answer
    
Thanks, and I guess and I was also missing the escaping character ``! –  user815423426 Sep 24 '12 at 23:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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