How to Find Files by Name (Case-Insensitive) in Ubuntu Linux

The Case-Sensitivity Problem

Unlike Windows, the Ubuntu Linux filesystem is strictly case-sensitive. To the Linux kernel, Document.pdf, DOCUMENT.pdf, and document.pdf are three completely different files. This creates a massive headache when you are trying to find a file but cannot remember exactly how the original author capitalized it. If you use the standard find -name command and guess the capitalization incorrectly, the terminal will confidently tell you the file does not exist. To guarantee you find what you are looking for, you must instruct the search engine to completely ignore capitalization.

Using the find Command with -iname

The Linux find command utilizes the -iname flag (Insensitive Name) to bypass the strict capitalization rules.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To search the entire server (/) for a file named “Invoice.pdf”, regardless of how it is capitalized, type the following command:
  3. sudo find / -type f -iname "invoice.pdf"
  4. Press Enter and provide your administrator password.

Using Wildcards

You can combine the case-insensitive flag with wildcard characters (the asterisk *) for even more powerful searches. For example, if you know you are looking for an invoice, but you aren’t sure if it’s a PDF, a Word Document, or a text file, you can type: find ~/Documents -type f -iname "invoice.*". This will instantly locate Invoice.pdf, INVOICE.docx, and invoice.txt simultaneously, saving you from having to run three separate search commands.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.