What happens when you type `ls -l *.c` in the shell

What happens when you type `ls -l *.c` in the shell

Faith Ikhidero's photo
Faith Ikhidero
·Aug 25, 2021·

1 min read

Before we talk about what happens when you type the above command, we must first breakdown and understand the concepts in the command.

  • Shell
  • ls
  • ls — l
  • *.c

Shell

According to the English Wikipedia, A Unix shell is a command-line interpreter or shell that provides a command line user interface for Unix-like operating system. The shell is both an interactive command language and a scripting language, and is used by the operating system to control the execution of the system using she’ll scripts. (read more https://en.m.wikipedia.org/wiki/Unix_shell)

ls

This is a unix command to list files and directories in the command line.

ls - l

This is a command to list files and directories in a long format on the command line.

*.c

This indicates that you want the command line to handle all files with the extension .c

From the explanations of the above unix commands, understanding the ‘ls -l *.c’ is made simple.

ls - l *.c

This command is to list all the files with the .c extension in a long format.

N.B The image at the top of this post illustrates what happens when you type the ls, ls -l, and ls - l *.c commands.

 
Share this