Vous êtes sur la page 1sur 1

Files and Directories In Unix, all data are stored in repositories called files.

The ls command The Unix command ls, lists the contents of the current working directory. The contents of a directory are the files and sub-directories inside that directory. The mkdir command You can use the mkdir command to create new directories. In the home directory, let us create a directory called Testdir1. The cd command You can move around from one directory to another with the cd command.

Naming the current and parent directories To review, we have seen how we can change to a particular directory by using the cd command followed by the name of the directory. Unix uses the special name .. (pronounced "dot dot") to refer to the parent directory of a particular directory. Note that each directory can have only one parent directory. The special name . ("dot") is used to refer to the current working directory. You can use these special names with the Unix commands that work with directories. Naming other directories Earlier we used the ls command to list the contents of the current working directory. You can use ls to look at the contents of a directory other than the one you're currently in, by specifying the directory. Let us list the contents of the sub-directory Testdir1. Stat,fstat and lstat Functions. The stat function returns a structure of the information about the named file. The fstat function obtains information about the file that is already open on the descriptor filedes. The lstat function is similar to stat, but when the names file is a symbolic link.

Vous aimerez peut-être aussi