devVinish.com

ls Command

To list files and directories on the system, use the ls command. This tutorial describes the ls command and options available to format the information it can display.

Using ls Command

To just display the content of a folder without any format, use the ls command:

ls

To distinguish the files from folders use the -F parameter

The -F parameter flags the folders with a forward slash.

ls -F

Display hidden files with normal Files

ls -a

List files contained in sub-folders

ls -F -R

Long list format

ls -l

Filtering files list

Just use the file name after any parameter or ls command to filter the list.

ls -l my_script

Filter using question (?) mark

The question mark can be used to replace exactly one character anywhere in the filter string. The following is an example:

ls -l my_scri?pt

Use Asterisk to match 0 or more characters

ls -l my*