LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Any arguement that can be used with 'ls' command to ignore case? (https://www.linuxquestions.org/questions/linux-newbie-8/any-arguement-that-can-be-used-with-ls-command-to-ignore-case-169501/)

davidas 04-13-2004 06:44 AM

Any arguement that can be used with 'ls' command to ignore case?
 
Some directories might have lots of files and some have names that contain capital letters. It would be useful to be able to list those directories without knowing which letter is in cap, hence the need for ignore case arguement for 'ls'.

Is there such an arguement to be used with 'ls' ?

Thanks :)

sims 04-13-2004 07:20 AM

Not quite sure what you mean, but I think grep will do what you ask for...

ls | grep -i dIRecToRY

davidas 04-13-2004 09:02 AM

Eg.

I have the following directories in my /myfolder directory:

subdiroNe
and ALOT more files in /myfolder

and I'm interested to (1) list the files in /myfolder/subdiroNe and to (2)check if subdiroNe directory exists. If I do a
Code:

ls subdiroNe
it will list the directory content if the directory exits (in this case it will list). But if I have forgotten that N is in caps, I would just done a
Code:

ls subdirone
which will return "The file or directory does not exist". So question is: Is there an arguement (aka grep's -i) that will allow ls to ignore case. ie.
Code:

ls -<some arguement> subdirone
and it will still list subdiroNe.

Thanks :)

Quote:

Originally posted by sims
Not quite sure what you mean, but I think grep will do what you ask for...

ls | grep -i dIRecToRY


sims 04-13-2004 09:34 AM

Sorry, don't think ls has this option. You could however do this:
Code:

ls `ls | grep -i subdirone`
The tab-completion comes in handy in these cases, of course.

jesus_edu 04-13-2004 10:34 AM

hello!
you can try so:
ls subdiro[nN]e
that will list subdirone or subdiroNe (or both, if there are there)

/bin/bash 02-26-2006 04:46 AM

Quote:

have the following directories in my /myfolder directory:

subdiroNe
and ALOT more files in /myfolder

and I'm interested to (1) list the files in /myfolder/subdiroNe and to (2)check if subdiroNe directory exists.
find /myfolder -iname subdirone


All times are GMT -5. The time now is 01:12 AM.