ls Linux Commands

What is Linux ls Command?

Explanation

ls COMMAND:

ls command lists the files and directories under current working directory.

SYNTAX :


ls [OPTIONS]... [FILE]

OPTIONS:


-l Lists all the files, directories and their mode, Number of links, owner of the file, file size, Modified date and time and filename.
-t Lists in order of last modification time.
-a Lists all entries including hidden files.
-d Lists directory files instead of contents.
-p Puts slash at the end of each directories.
-u List in order of last access time.
-i Display inode information.
-ltr List files order by date.
-lSr List files order by file size.

EXAMPLE:


  1. Display root directory contents:
    ls /

    lists the contents of root directory.
  2. Display hidden files and directories:
    ls -a

    lists all entries including hidden files and directories.
  3. Display inode information:
    ls -i
    7373073 book.gif
    7373074 clock.gif 7373082 globe.gif 7373078 pencil.gif 7373080 child.gif 7373081 email.gif 7373076 indigo.gif

    The above command displays filename with inode value.

Ask Questions

Ask Question