Introduction to File Management in Unix
Before beginning this course you should be comfortable with the following concepts.
- Using the
ls command to list files
- Using wildcards (
) to create an efficient shorthand system for specifying file names
- How to copy, move, or remove files using
cp, mv, or rm
- How to create or remove directories using
This module will discuss advanced file management tasks. By the end of this module, you will be able to:
- List files recursively and list hidden files
- Copy a directory
- Remove a directory tree
- Create a link
- Find files on the system
In the next lesson, advanced ways to list files using the
command will be discussed.
File Based Concepts
To gain a full picture of the internal operation of filesystems, it is necessary to understand what the user sees, why things are presented they way they are, and what the main concepts are. This module provides an introduction to basic file concepts.
Users experienced in UNIX may wish to skip this chapter. Users new to UNIX and those starting to program in the UNIX environment will find these concepts useful. A basic implementation of the ls program helps to reinforce the material presented and provides an introduction to file-related libraries and system calls, a topic that will
be expanded upon in the next chapter.
One peculiarity that UNIX introduced was the notion that everything in the UNIX namespace (file tree) is visible as a file and that the same operations can be applied to all file types.
Thus one can open and read a directory in the same way in which a file can be opened and read.
Of course, this does not always have the desired effect. For example, running the UNIX command cat on a directory will likely produce a screen full of unreadable characters. However, these and other
simple concepts are one of the great strengths of UNIX. The following sections provide introductory material which describe file-based concepts and start to paint a picture of how these components fit together.