next up previous contents index
Next: Managing Files and Directories Up: Linux Shell Environment Previous: Running in the Background   Contents   Index

Listing Files and Directories

Listing the files is a directory is not very complex. You can type the well known ``dir'' command or you can use the UNIX ls command. The ls command is short for list. To list all of the files in the directory in a long format type:

bash$ ls -al
total 48
drwx------    4 bob      bob          4096 Feb 26 10:33 .
drwxr-xr-x    5 root     root         4096 Feb 26 10:33 ..
-rw-r--r--    1 bob      bob            24 Feb 26 10:33 .bash_logout
-rw-r--r--    1 bob      bob           224 Feb 26 10:33 .bash_profile
-rw-r--r--    1 bob      bob           124 Feb 26 10:33 .bashrc
-rw-r--r--    1 bob      bob          5450 Feb 26 10:33 .canna
drwxr-xr-x    2 bob      bob          4096 Feb 26 10:33 Desktop
-rw-r--r--    1 bob      bob           747 Feb 26 10:33 .emacs
drwxr-xr-x    3 bob      bob          4096 Feb 26 10:33 .kde
-rw-r--r--    1 bob      bob          3728 Feb 26 10:33 .screenrc
-r--r--r--    1 bob      bob          1019 Feb 26 10:33 .wl

If you wanted to see the same files in a lot less space you could type:

bash$ ls -a
.       ..   .bash_logout  .bash_profile  .bashrc  .canna  Desktop
.emacs .kde  .screenrc     .wl

The files that have a leading period are the hidden files. If you were to leave out the -a argument the list would look like this:

bash$ ls
Desktop

Not a very long list. Since Desktop is a directory you can see the contents of that directory by typing the directory after the ls command:

bash$ ls Desktop
Autostart       kontrol-panel  Linux Documentation  Printer
www.redhat.com



Joseph Colton 2002-09-24