Fri. Aug 14th, 2020

How to list directory contents in Linux

1 min read

ls – list directory contents.

List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.

How to list directory contents in Linux

Use

Example

Without any options and path to directly display, ls command shows the file list of the current location.

To show all files, including hidden files, you add -a parameter

To display more info, you add -l parameter

To display the human-readable size, you add -h parameter

To sort display in ascending order by modification time; parameter -rt displays sorting in descending order by modification time