What happens when you type ls *.c
First lets talk about ls command.
The ls command is super useful when we need to see the files and directories that we have in the directory that we are in.
When you execute the ls command without options, it lists the files contained in the current directory, and sorting them alphabetically
There are so many options to ls, and you can see them typing ls - -help in your console. Some of them are:
This options are so hepful when you need to list something in specific, and you dont know what the option is. For example ifyou need to find hidden directories, you could use de option a.
Now, lets talk about “*”
Wildcards or regular expresions are used by Linux for character substitution or sequence of charater. These wildcards character can be very useful when we se the command to find a file, or several files or directories whose name contains a certain sequence of characters. “*” is a wildcard among many others.
The wildcard “*” references any character string in the file name. When the character “*” is used to refer to the name of a file, the command interpreter replaces it with all the possible combinations coming from the files in the directory to which we are referring.
Thereby, when you type ls *.c in your console, you are listing the files or directories that contains a .c extension at the end of their names, in the current directory.
If you want to understand mor about the ls command and wildcards, you can visit the next urls:
Standard wildcards (also known as globbing patterns) are used by various command-line utilities to work with multiple…
ls(1) - Linux manual page
LS(1) User Commands LS(1) ls - list directory contents List information about the FILEs (the current directory by…