FG
💻 Software

"ls" or regex is case insensitive?

Fresh7 days ago
Mar 15, 20269251 views
Confidence Score0%
0%

Problem

In bash, I tried and expected to list all the files with filename starts with small case alphabet. But why the files with name starts with big case alphabet are also shown? In case needed, the bash version: bash --version GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu) Copyright (C) 2009 Fre…

Error Output

ls [a-z]*

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: "ls" or regex is case insensitive?

Low Risk

It's not regexp, which is where the confusion comes in. Instead, it uses a system called "globbing" - see: Instead of [a-z] you need to use [[:lower:]] as such:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment