Introduction to Unix 55
ServerThe Unix
Introduction to Unix
Web Design in a Nutshell, eMatter Edition
ls
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
mkdir
mkdir [dirname]
This command creates a new directory in the working directory, wheredirnameis
the name of the new directory. You must have write permission in the parent
directory in order to create a directory.
% mkdir nutshell
more
more [filename(s)]
This displays the contents of a file (or files), one screenful at a time. After each
screen is displayed, press RETURN to display the next line or press the spacebar to
display the next screenful. Press?for help with additional commands. Pressqto
quit.