Michael Galindez
3 min readApr 14, 2020

--

What happens when you type ls -l in the shell

what will happen when we type ls *.c ? . Before start we need to explain what is The Shell and how it workks.

command line is the shell. The shell is a program that takes keyboard commands and passes them to the operating system to be EXECUTED. Almost all Linux distributions supply a shell program called Bash. The name “bash” is an acronym for “Bourne Again SHell”, a reference to the fact bash is replacement for sh, the original Unix shell.

Now that you know what bash is we go to the commands, ls is one of the most basic and fundamental commands in linux ,It’s short for the word list [ls] So by typing ls, you get:

what you see in the picture is the command output that means that the command was succesfully executed and shows the list of directories and files in the current directory in this case i am in the /Proc directory but you can use this command anywhere.

In linux nearly all the commands have something called wildcards and arguments, this are options for the commands that can be very useful when working in linux, a basic example of this is the command ls -1 that lists all the files (LS) but in a vertical way instead of horizontal like the default ls

This is very useful to find files or work with specific information, you can visit the manual of ls command to see a complete list of arguments, wildcards ,etc about this command.

commad execution

The shell searches for the command in the built-in functions if it’s not there, it will find the $PATH, an global environmental variable specifying where the executable programs are located. Once found, the command is executed. The commands.

The Shell waits for the command to completely executed, then after its done, exits the command and Bash prints the prompt again.

ls -l

Now that we know how the command LS works lets talk about ls -l the -l is used to -l use a long listing format this will display nearly all the information about the files as shown in the picture:

This will show file permissions, group (user groups), author (the user with the file ownership), time, file name, etc.

this info is very useful when you are worknig with bash like scripting (create files that will execute determined commands by you), and that kind of stuff also to sort files by an specific propriety and a lot a lot more, thats the beautify of linux, you have alot of options to work with and there is always a way to do what you want to do.

--

--