I'm trying to find all files for which there name starts with a capital letter. I have tried using the following command:

find . -type f -regex '.*\/[A-Z][^/]*'

It's finding paths with only lowercase letters. The following works:

find . -type f -regex '.*\/[ABCDEFGHIJKLMNOPQRSTUVWXYZ][^/]*'

As does:

find . -type f | grep '.*\/[A-Z][^/]*$'

I've tried all the different options for regextype, with the same result.

Why does find include lowercase letters in [A-Z]? I thought the regex for that was [a-zA-Z]. Is there any way to specify a range of only uppercase letters in find?

  • 5
    What about LC_ALL=C find ...?
    – mikeserv
    Oct 25, 2014 at 15:12
  • That works. Could you explain why in an answer? Oct 25, 2014 at 15:14
  • 3
    I could try, but then you might miss out on this.
    – mikeserv
    Oct 25, 2014 at 15:18
  • 1
    Why are you escaping the slash (\/)? Also what find are you using (find --version)? Oct 25, 2014 at 16:16
  • 1
    Escaping / is only necessary when you're using it as a delimiter, e.g. in s/foo\/bar/foobar/. (But often you can use some other delimiter: s#foo/bar#foobar#.)
    – deltab
    Oct 26, 2014 at 4:32

1 Answer 1


You don't need to use -regex. You can use -name instead.

find . -type f -name "[[:upper:]]*"
  • If I wanted to use -regex instead of -name, what’s the correct syntax for it?
    – Lucas
    Feb 10, 2021 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .