Name

ls

Synopsis

                        ls [option(s)] [name(s)]

This gives you a listing of the files and subdirectories (denoted with a slash) in your working directory. Adding a directory name after the options gives you the list of files within the named directory.

Options

-a

shows all the files within the directory, including normally hidden files.

-c

lists files by creation/modification time.

-l

displays long format listing (includes permissions, owner, size, modification time, etc.)

-p

marks directories by adding a slash at the end of the name

-x

displays the list in rows going across the screen.

Example

A simple listing of names in the current directory:

% ls
work
pers
ch01
ch02
ch03

List directory contents across the screen with directories indicated with a slash ( / ):

% ls -px
work/     pers/     ch01     ch02     ch03

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.