Friday, 11 January 2013

Case Sensitivity in UNIX and Linux

In UNIX and Linux, names are case sensitive. Here is an example. We start in an empty directory. Then we create 4 files with the same name. One filename is in lower case. One file name is in upper case. The other filenames have a combination of upper and lower case letters: 

UBUNTU > ls
UBUNTU > touch fila1 Fila1 FiLa1 FILA1
UBUNTU > ls
fila1 Fila1 FiLa1 FILA1
UBUNTU > 

You can do the same thing with directories:

UBUNTU > ls -l
total 0
-rw-r--r-- 1 andrew users 0 Aug 27 20:54 fila1
-rw-r--r-- 1 andrew users 0 Aug 27 20:54 Fila1
-rw-r--r-- 1 andrew users 0 Aug 27 20:54 FiLa1
-rw-r--r-- 1 andrew users 0 Aug 27 20:54 FILA1
UBUNTU > mkdir dir1 Dir1 DiR1 DIR1
UBUNTU > ls -l
total 16
drwxr-xr-x 2 andrew users 4096 Aug 27 21:00 dir1
drwxr-xr-x 2 andrew users 4096 Aug 27 21:00 Dir1
drwxr-xr-x 2 andrew users 4096 Aug 27 21:00 DiR1
drwxr-xr-x 2 andrew users 4096 Aug 27 21:00 DIR1
-rw-r--r-- 1 andrew users    0 Aug 27 20:54 fila1
-rw-r--r-- 1 andrew users    0 Aug 27 20:54 Fila1
-rw-r--r-- 1 andrew users    0 Aug 27 20:54 FiLa1
-rw-r--r-- 1 andrew users    0 Aug 27 20:54 FILA1
UBUNTU >