Linux: Case-insensitive file searching with locate and find | alvinalexander.com (2024)

Table of Contents

  1. Case-insensitive file searching with the locate command
  2. Case-insensitive file searching with the find command
  3. More ‘find’ command options

Earlier today someone asked for the source code for my TypeAhead predictive-text, type-ahead, auto-complete JNLP Swing application. While trying to remember where I put it I realized I was going to have to do some case-insensitive file searching on my Mac/macOS system.

I was happy to learn that both of my favorite Unix and Linux file-finding utilities support case-insensitive file searching. Both the find command and the Mac locate command have command-line options that provide this support.

In this short tutorial I’ll demonstrate both commands for case-insensitive file-searching on Mac and Unix/Linux systems.

Case-insensitive file searching with the locate command

For the Unix/Linux locate command, just add the -i flag. To search my entire filesystem for files and directories that contain the string typeahead, just use this command:

locate -i typeahead

As mentioned, that is a case-insensitive search, so it will find all variations of typeahead, like typeahead, TYPEAHEAD, TypeAhead, etc. (This assumes that you have the locate command installed and running.)

Case-insensitive file searching with the find command

If for some reason you can't find your files with the Linux locate command, or your system doesn't have the locate command installed, you can also search with the traditional Unix find command.

Here's how I did a case-insensitive search trying to find the same typeahead files with the find command:

find . -type f -iname "*typeahead*"

In this example I use the -type f option to tell find to just look for files, and not directories. If you want to search for files and directories, leave that option off.

Note that on some systems you may also have to use the -print option at the end of that command, like this:

find . -type f -iname "*typeahead*" -print

The key to that case-insensitive search is the use of the -iname option, which is only one character different from the -name option. The -iname option is what makes the search case-insensitive.

More ‘find’ command options

Note that the Linux find command has several more case-insensitive operators, including these, which I'm taking directly from the find command man page:

-ilname pattern Like -lname, but the match is case insensitive. If the -L option or the -follow option is in effect, this test returns false unless the symbolic link is broken.-iregex pattern Like -regex, but the match is case insensitive.-iwholename pattern Like -wholename, but the match is case insensitive.
Linux: Case-insensitive file searching with locate and find | alvinalexander.com (2024)
Top Articles
[Solved] The maximum total settlement for isolated foundations on cla
Rewards with Xbox
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
Non Sequitur
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 5903

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.