SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Sunday, April 27, 2008

Listing directory contents in Linux operating system

ls list a directory
ls -l list a directory in long ( detailed ) format
ls / List the contents of your root directory.
ls ../ List the contents of the parent directory.
ls */ List the contents of all sub directories.
ls -d */ Only list the directories in the current directory.

for example:
$ ls -l
drwxr-xr-x 4 lost user 10254 Jan 8 19:40 Templates
-rw-r--r-- 1 lost user 76739 Jun 6 10:28 rails.tar.gz
^ ^ ^ ^ ^ owner group size date time name
| | | | |
| | | | |
| | | | number of links to file or directory contents
| | | permissions for world
| | permissions for members of group
| permissions for owner of file: r = read, w = write, x = execute -=no permission
type of file: - = normal file, d=directory, l = symbolic link, and others...


ls -a List the current directory including hidden files. Hidden files start
with "."
ls -ld * List all the file and directory names in the current directory using
long format. Without the "d" option, ls would list the contents
of any sub-directory of the current. With the "d" option, ls
just lists them like regular files.

No comments :

Post a Comment