Display Files in a Directory

Grasp a variety of ways to list down files in directories!

ls

Definition:

ls is the most frequently used commands in Linux. This command prints the content of current directory on the terminal in an alphabetical order. This command can be used along with many other options to show additional informtation as well. By default, it is set to show contents of the current directory but we can also use this command to gain information about any file

Syntax:

ls [option] file_name

Options:

Option Meaning
-a List all the files, even those starting with .
-C List files column-wise
-i To show the index number of each file
-s To show the size of each file
-1 To show one file per line

Example:

  • To view hidden files in the current directory

ls -a

Get hands-on with 1400+ tech skills courses.