1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Example uses of the command "ls"

A Brief Introduction


The simplest use of ls is

which prints a list of the files in the current directory to the terminal. Without any parameters, the files are written out in columns, such that several files names appear on each line.

In general it is easier to scan the contents of a directory if only one file is listed per line along with some information about that file. This is accomplished with the -l flag. For example:

ls -l

If you also want to see files whose names start with a period, you would include an "a":

ls -al
You can now use the alias command

alias l="ls -al"
which defines "l" as "ls -al", so that entering "l" will have the same effect as entering "ls -al".
  1. About.com
  2. Technology
  3. Linux
  4. Linux / Shell Commands
  5. Example uses of the Linux shell Command "ls"

©2014 About.com. All rights reserved.