List files with a condition

Julian Villegas
Basics Full Stack Engineering
1 min readSep 17, 2019

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)

man page for ls command

Case Study

Let’s proove the next script. ls *.c and hit Enter in your shell

Shell Scripting

If you see, it list all files with the specific extention in the working directory. Many other options is either possible with this command.

--

--

Julian Villegas
Basics Full Stack Engineering

Professional System Engineer and Student at Holberton School Colombia