The ls
command in Linux and Unix is case-sensitive by default, but you can make it case-insensitive by using the -f
option (which tells ls
to not sort the files) in combination with the -i
option (which tells ls
to ignore the case when sorting).
Here’s an example command that runs the ls
command in case-insensitive mode:
ls -fi
This command will list the files in the current directory in case-insensitive order, and it will not sort the files by name.
Alternatively, you can use the find
command with the -iname
option, this option allows you to search for a file with a specific name, ignoring the case:
find . -iname 'file*'
This command will search for files starting with ‘file’ in the current directory and all subdirectories, regardless of the case.
Another option is to use the grep
command with the -i
option, it allows you to search in a file or a list of files ignoring the case:
ls -l | grep -i 'file'
This command will list all the files in the current directory, and then it will search for the files that contains ‘file’ in the name ignoring the case of the letters.
Please keep in mind that these options are not permanent, they will only affect the current command execution, if you want to make it permanent you need to include it in your shell profile or alias it to another command.