List files with a condition
ls command is one of the most common used in Linux shell Script. This tutorial will explain you how to list files with a specific extention in the current working directory.
Firsthly, we should to define the ls definition and function.
ls is used to list the contents of a directory (files and directories).
In Linux terminal, you can find the definition and attributes of each bash shell programs with man command (i.e. man ls)
Case Study
Let’s proove the next script. ls *.c
and hit Enter in your shell
If you see, it list all files with the specific extention in the working directory. Many other options is either possible with this command.