What happens when you enter “ls *.c” in your terminal

--

Before kicking off on what this line of command does, we have to review some basic concepts first, in order to understand fully this topic.

Some of these concepts are: Linux, Ubuntu, Unix, Bash, and Linux Terminal. Linux is the best-known operating system, not only because it’s an open source but also because of all of the components that this software has to offer. Ubuntu is a complete Linux operating system which is also available to all of the community; it’s principles encourage people to work on this software so that everybody can freely make changes in their local machines. Unix is a command-line interpreter that provides every user an interface for Unix-like operating systems. Bash is a Unix shell that usually runs in a text window where Unix users can run commands. The Linux terminal is one of the Linux is one of the system consoles provided in the Linux kernel and acts as a medium between the input and output operations for a Linux system.

Taking into account what we just read, it’s important to highlight that “ls” is a command that lists computer files in Unix and Unix-like operating systems. When you enter “ls” into your terminal without any options nor arguments, it lists all of the files in the directory that you’re working on. When you add the argument * (which is a wildcard) it means that it’s going to list everything that matches any character that you add after or before it, depending if you’re looking that the characters start or finish in the name of the files. In this case we added .c after the asterisk meaning that it will list every file that ends with “.c”.

So if you add all of these pieces of the line of command, it makes your terminal look for all the files that you have in your current working directory that ends in “.c” and lists them all. It’s very important to fully understand this command because it’s one of the most used ones of them all. You will need to list what files you have in a directory very often when manipulating files and directories.

I am currently enrolled in Holberton School, and one of my projects is to explain this line of command, so please try to be comprehensive if with my vocabulary. Thank you for reading this article, I really appreciate it.

--

--