insensitive

Case Insensitive List (ls)

When I’m using a Unix-like terminal I don’t always remember the full name of a directory or file.  In a Unix-like world, file and directory names are case sensitive.

Sometimes the system we are logged into is not always our own and therefore not customized with default settings.  In these situations the following knowledge can be helpful.

ls -Fd [Vv]*

Using the standard list command we get the following,

case-insensitive-ls-1

Here is the same directory listing using the case insensitive approach,

case-insensitive-ls-2

I use the -F switch to identify which items in the output are directories.  The formal definition of the -F switch is,

Display a slash (`/’) immediately after each pathname that is a directory, an asterisk (`*’) after each that is executable, an at sign (`@’) after each symbolic link, an equals sign (`=’) after each socket, a percent sign (`%’) after each whiteout, and a vertical bar (`|’) after each that is a FIFO.

I use the -d switch to tell Bash I do not want to recursively descend into directories.  The formal definition of the -d switch is,

Directories are listed as plain files (not searched recursively).

The example above along with the definitions are from OS X 10.9.1