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,


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


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

Terminal Colors with Bash

The following is a script I would use for testing. I used it for viewing colors and layout; it’s good for enhancing script feed-back when the script is interactive.

# Script Name:
# Version: 0.1.1
# Created on: 3/2/2011 Jeff Neuffer Jr
# Updated on: $Id: 105 2013-03-17 14:50:53Z jneuffer $
# Purpose: Display terminal colors

txtblk='33[0;30m' # Black - Regular
txtred='33[0;31m' # Red
txtgrn='33[0;32m' # Green
txtylw='33[0;33m' # Yellow
txtblu='33[0;34m' # Blue
txtpur='33[0;35m' # Purple
txtcyn='33[0;36m' # Cyan
txtwht='33[0;37m' # White

bldblk='33[1;30m' # Black - Bold
bldred='33[1;31m' # Red
bldgrn='33[1;32m' # Green
bldylw='33[1;33m' # Yellow
bldblu='33[1;34m' # Blue
bldpur='33[1;35m' # Purple
bldcyn='33[1;36m' # Cyan
bldwht='33[1;37m' # White

unkblk='33[4;30m' # Black - Underline
undred='33[4;31m' # Red
undgrn='33[4;32m' # Green
undylw='33[4;33m' # Yellow
undblu='33[4;34m' # Blue
undpur='33[4;35m' # Purple
undcyn='33[4;36m' # Cyan
undwht='33[4;37m' # White

bakblk='33[40m'   # Black - Background
bakred='33[41m'   # Red
badgrn='33[42m'   # Green
bakylw='33[43m'   # Yellow
bakblu='33[44m'   # Blue
bakpur='33[45m'   # Purple
bakcyn='33[46m'   # Cyan
bakwht='33[47m'   # White

txtrst='33[0m'    # Text Reset

echo -e "33[0;30;47m[         Backup VM Disks           ]33[0m"
echo -e "   33[0;30;47m[ Unregister HDD          ]33[0m"
echo -e "   33[0;30;47m[ Cloning HDD Start       ]33[0m"
echo -e "   33[0;30;47m[ Re-attaching HDD to VM  ]33[0m"
echo; echo;
echo -e "33[0;30;43m[               Disk Usage                   ]33[0m"
df -h

echo; echo;

echo; echo;

Here is what the script produced,

There is a better way to view the colors, here is the output from a script from the “Bash-Prompt-HOWTO” [Ref 1]

[Ref 1]: