Owner's manual

8 Managing Files
This chapter discusses how to manage OSS files. After reading this chapter, you will be able to:
List files
Display and print files
Copy, rename, and move files
Compare and sort files
Remove files from the system
Link files
Determine file type
A good way to learn about managing OSS files is to try the examples in this chapter. Do the
examples in the order given so that the information on your screen is consistent with the text.
Before you can work through the examples, you must be in your home directory, which must contain
the following three files created in Chapter 7 (page 90): file1, file2, and file3.
To produce a listing of the files in your home directory, enter the ls command, which is explained
in “Listing Files (ls)” (page 93). If you are using files with names different from those created in
Chapter 7 (page 90), make the appropriate substitutions as you work through the examples.
In the following examples, when you are asked to return to your home directory, enter the cd
(change directory) command as follows:
$ cd
Note that, in the preceding example, the $ (dollar sign) represents the OSS shell prompt. Your
shell prompt and cursor might vary.
In addition to the three files you created in Chapter 7 (page 90), you’ll need to create a subdirectory
called /project in your home directory. To do so, enter the following mkdir (make directory)
command from your home directory:
$ mkdir project
For more information on the cd and mkdir commands, see Chapter 9 (page 113).
Listing Files (ls)
You can display a listing of the contents of one or more directories with the ls (list directory)
command. This command produces a list of the files and subdirectories (if any) in your current
directory. You can also display other types of information, such as the contents of directories other
than your current directory.
The general format of the ls command is:
ls
The ls command has a number of flags that enable you to display different types of information
about the contents of a directory. Refer to “OSS Directories and Subdirectories” (page 27) for
information about these flags.
Listing Contents of the Current Directory
When used without flags, the ls command simply lists the names of the files and directories in
your current directory:
$ ls
file1 file2 file3 project
Listing Files (ls) 93