[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 865
  • Last Modified:

Linux ls command - case sensitive

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
0
TropicalBound
Asked:
TropicalBound
  • 3
  • 2
1 Solution
 
MazdajaiCommented:
There isn't an easy to list files case insensitivity with ls , I suggest try using grep:

ls -l |grep -i myfile

Open in new window

0
 
TropicalBoundAuthor Commented:
OK.  That works.  Is there another command to list files besides ls?
0
 
MazdajaiCommented:
There are probably alternatives ... but not all Linux versions ship with them natively.

Specifically what feature are you looking for?
0
 
TropicalBoundAuthor 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*
0
 
MazdajaiCommented:
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.  )
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now