Wow, so now you are zipping all about the
file system. However, you still can't do much in any of the directories
you move to until you have some means of reading the contents of
the directories you have moved to.
To get a directory listing, you will use
the "ls" utility which follows the rules described in the table
|ls options filelist.
||ls -l /home/selena/public_html/*.html
||Lists the specified contents of the specified directory
according to the options setting.
The options for the "ls" command are described in
the table below:
||Lists "ALL" files (including hidden ones) but not the
current or parent directories ("." or "..").
||Lists "ALL" files including hidden ones and both
current and parent directories ("." and "..").
||Lists files in columns sorted from top to bottom, left
||lists directory names only.
This is very useful since "ls directory_name" will give you the listing of
that directory rather than showing you if the named directory is actually
in the current.
||Adds a "/" for directories and a "*" for executables.
||Lists the inode number.
||Provides a "long" listing with details about
such things as file permission, age, date created,
date of last modification, etc.
||Reverses the sort order.
||Lists sub-directories recursively.
||Lists files in columns sorted from left
to right then top to bottom.
Here are some examples of using the
"ls" command. Note that you can use multiple options at
one time by simply adding them to the option list.
Notice in the example above, the ls command
turned up quite a different file list than the ls -a even though they
were listing the same directory. This is because the ls -a command
lists hidden files as well as normal files.
A Hidden File is a file whose name begins with
a period. These files are usually administrative files and
are often distracting when you are doing your daily work. Thus
UNIX hides them unless you specifically ask to see them with the
Okay, here are some more examples of the ls
Now you practice using the "ls"
utility in some of the directories you moved to in the last
Focus on the "-l" Option
Before moving on, we should say a little bit more
about the "-l" option because you will find yourself using this
one quite a bit when you want to know more information about the
files and directories in a listing.
The image below shows a typical "-l"
listing. In the image you will see that there are several fields
listed for each file.
The following table overviews the information
provided by the -l option...
||Is this a regular file or a directory. "-" denotes
a regular file, "d" denotes a directory, "c" denotes a character special file,
a "b" specifies a block special file, a "l" represents a symbolic
link, and a "p" specified a named pipe.
||User, Group and World privileges. We will discuss this
in much greater detail in just a moment
||The number of names for this file or directory
||We will discuss this later
||We will discuss this later
||The size of the file in bytes
||The last time the file was modified
||The name of the UNIX Version. No just kidding. The file's name
The ls -l option also includes several options
that affect the listing. These options are shown below:
||Sorts by the last time the inode was changed
with the -t option
||Sorts listing by modification time.
||Sorts by the last time accessed.
Table of Contents