We help IT Professionals succeed at work.

Linux ls command - case sensitive

2,092 Views
Last Modified: 2014-08-26
When I view the contents of a directory, I'll use 'ls -l'.  However, the results are case sensitive.  For example, if I have a file called MyFile.txt:

ls -l /mnt/mountpoint/myfile* --> no results
ls -l /mnt/mountpoint/MyFile* --> shows the file

Sometimes I do not know if a file has upper case letters or not.  Is there a way to list the contents of a folder regardless of upper and lower case names?

Thanks

TB
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
OK.  That works.  Is there another command to list files besides ls?
CERTIFIED EXPERT

Commented:
There are probably alternatives ... but not all Linux versions ship with them natively.

Specifically what feature are you looking for?

Author

Commented:
I have a need to search a Windows Server folder for text files containing the user's first initial and last name.  Most of the time, the file name is all lower case, but occasionally the first two letters are capitalized.  ls -l /mnt/mountpoint | grep -i jdoe* is a little bulky compared to the Windows variant of dir \\server\share\jdoe*
CERTIFIED EXPERT

Commented:
There is no case insensitive option you can turn on to to ignore case.

I am not aware any built-in alternative on top of my head. There may be 3rd party tools but require installation. (Case sensitivity is the nature of Linux environment.  )
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.