Friday, December 26, 2008

Checking directories and permissions

Associated with each shell is a location in the Linux file system known as the current or working directory. As previously mentioned, each user has a directory that is identified as the user’s home directory.
When you first log in to Linux, you begin with your home directory as the current directory. When you request to open or save a file, your shell uses the current directory as the point of reference.
Simply give a filename when you save a file and it will be placed in the current directory. Alternatively, you can identify a file by its relation to the current directory (relative path). Or you can ignore the current directory and identify a file by the full directory hierarchy that locates it (absolute path).
To find out what your current directory is, type the pwd command:
$ pwd
/usr/bin
At this point, list the contents of your home directory, using the ls command. Either you can type the full path to your home directory to list its contents, or you can use the ls command without a directory name to list the contents of the current directory. Using the −a option to ls enables you to view the hidden files (dot files) as well as other files. With the −l option, you can see a long, detailed list of information on each file.
$ ls −la /home/nitin
You can get the total files in home directory of user 'nitin', with the read/write permissions associated with the file.

No comments:

Post a Comment