Saturday, January 8, 2011

ls linux command



Ls command is used to list the contents of a directory. If no directory names are given, list the files in the current directory otherwise list the files in the given directory.



Examples

ls -l
In the above example this command would list each of the files in the current working directory and the files permissions, the size of the file, date of the last modification, and the file name or directory.

Syntax


ls [option] /path/of/directory


Options


-a, --all
do not hide entries starting with ‘.’(show all hidden files)


-l,  --file-details
use a long listing format.


-d, --directory
list directory entries instead of contents


-i, --inode
with -l, print the index number of each file


-r, --reverse
reverse order while sorting

-R, --recursive
list subdirectories recursively

-s, --size
with -l, print size of each file, in blocks

-S, --sort
sort by file size

-t, --sort
sort by modification time

-v, --sort
sort by version

-X, --sort
sort alphabetically by entry extension

-1, --line
list one file per line

No comments:

Post a Comment