Wednesday, January 25, 2017

Unix Command -ls (list)

ls (list):-

When you first login, your current wo



rking directory is your home directory. Your home directory has the same name as your user-name, for example, ee91ab, and it is where your personal files and subdirectories are saved.
To find out what is in your home directory, type
% ls

The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory.

To list all files in your home directory including those whose names begin with a dot, type
% ls -a
As you can see, ls -a lists files that are normally hidden.


ls -l

Here, ls -l (-l is character not one) shows file or directory, size, modified date and time, file or folder name and owner of file and it’s permission.

ls -lh

With combination of -lh option, shows sizes in human readable format.

ls -F

Using -F option with ls command, will add the ‘/’ Character at the end each directory.

ls -R

ls -R option will list very long listing directory trees.


ls -ltr

With combination of -ltr will shows latest modification file or directory date as last.

ls -IS

With combination of -lS displays file size in order, will display big in size first.

ls - i
We can see some number printed before file / directory name. With -i options list file / directory with inode number.
ls --version
Check version of ls command.
ls -n
To display UID and GID of files and directories. use option -n with ls command.

To order files based on last modified time(In Reverse Order):
$ ls -ltr



No comments:

Post a Comment