LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2004, 06:44 AM   #1
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Rep: Reputation: 30
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
 
Old 04-13-2004, 07:20 AM   #2
sims
Member
 
Registered: Mar 2004
Location: Australia
Distribution: Debian, Ubuntu
Posts: 55

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

ls | grep -i dIRecToRY
 
Old 04-13-2004, 09:02 AM   #3
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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
 
Old 04-13-2004, 09:34 AM   #4
sims
Member
 
Registered: Mar 2004
Location: Australia
Distribution: Debian, Ubuntu
Posts: 55

Rep: Reputation: 15
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.
 
Old 04-13-2004, 10:34 AM   #5
jesus_edu
LQ Newbie
 
Registered: Mar 2004
Location: Darmstadt, Germany
Distribution: Suse 9.0
Posts: 29

Rep: Reputation: 15
hello!
you can try so:
ls subdiro[nN]e
that will list subdirone or subdiroNe (or both, if there are there)
 
Old 02-26-2006, 04:46 AM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to paginate in the 'LS' command? jhecht Linux - Software 10 04-13-2010 06:15 AM
Problem in case command - RH9 Gald3r Red Hat 1 09-19-2005 06:52 PM
case insensitive search command ColKurtz Linux - Newbie 4 01-20-2005 07:02 AM
'ls' command... sramelyk Slackware 7 10-01-2003 12:45 PM
creation date of file using the 'ls' command robt Linux - Newbie 1 03-27-2003 12:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration