Category: Linux Terminal

Added: 22nd of July 2020

Viewed: 2,509 times

List files in a directory using the ls command

The ls command is almost identical the dir command for listing files in a directory. From what I have seen the only difference is that the ls command can colourise the output

To use the ls command for example listing the contents of a directory use the folllowing command


The ls -l command will display the file permission, owner and group, filesize and modification date and the filename
ls -l

To list a specific file type, for example only .txt files, we could enter the following command
ls -l *.txt

We can also output the listing to a text file for example
ls -l *.jpg > output.txt

You can get furter information about the ls command by enterting the following command in the terminal
ls --help