
Directories are created by the following command − We will now understand how to create directories. To list the files in a directory, you can use the following syntax −įollowing is the example to list all the files contained in /usr/local directory − To determine where you are within the filesystem hierarchy at any time, enter the command pwd to print the current working directory − Relative to user amrood's home directory, some pathnames might look like this −

A pathname is absolute, if it is described in relation to root, thus absolute pathnames always begin with a /.įollowing are some examples of absolute filenames.Ī pathname can also be relative to your current working directory. The position of any file within the hierarchy is described by its pathname.Įlements of a pathname are separated by a /. To go in your last directory, you can use the following command −ĭirectories are arranged in a hierarchy with root (/) at the top. Suppose you have to go in any other user's home directory, use the following command − You can go in your home directory anytime using the following command − You will be doing much of your work in your home directory and subdirectories that you'll be creating to organize your files. The directory in which you find yourself when you first login is called your home directory. The tree has a single root node, the slash character ( /), and all other directories are contained below it. This structure is often referred to as a directory tree.

Unix uses a hierarchical structure for organizing files and directories. All the files, whether ordinary, special, or directory, are contained in directories. In this chapter, we will discuss in detail about directory management in Unix.Ī directory is a file the solo job of which is to store the file names and the related information.
