What is ls *.c ?

Before we answer that question, there’s a little background information that you should be aware of.

ls is a command, in the terminal of your computer, that lists all the files and directories. A directory is also known as a folder that may or may not contain other files or directories. A file contains data that can be opened even after the program has stopped running. It could range from a text document, such as something that you would type up on Microsoft Word, a C program saved on a text editor, a PowerPoint file, etc.

The picture above shows a few files and directories.

Next, we have the asterisk (*). This is also known as a wildcard symbol which tells the terminal to find all instances, of whatever comes after it, in the current directory.

Last but not least, we have .c portion. This indicates a particular file with a .c extension. Much like how there are .html, .txt, and other types of files, .c is indicating any files with the .c extension.

In the picture above, you can see three files with three different extensions: file1.html, file2.c, and hello.txt

Adding those pieces together, ls *.c lists all the files with the .c extension within the current directory.

This is very helpful in case you happened to save many files with different extensions in the same folder.