Linux Command | File Management | ls List Files

ls Command

Displays all files in the current location or a specified location. ls stands for list.

Syntax

ls (options) (path; current location if omitted)

Options

  • -l: Detailed view
  • -a: Show all files, including hidden files
  • -r: Reverse order
  • -R: Show subdirectories recursively
  • -t: Sort by time
  • -lrt: Detailed time order from top to bottom

NOTE: Linux is case-sensitive, so -r and -R are different.

Examples

Show the current directory list.

ls

Show /home/devkuma in detail.

ls -l /home/devkuma

Show hidden files in /etc.

ls -a /etc

Files starting with . are hidden files, such as .ssh.

Show subdirectories under /etc recursively.

ls -R /etc

Show hidden files and all subdirectories under /etc in detail.

ls -alR /etc