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

Arafat Mamia
4 min readNov 2, 2021

--

In this writing I will explain what happens when you(a user )type ls *.c into terminal. Terminal …new word ……haaa…….

I recognize that some readers may not know what a terminal is so I will start from absolute basics and I will explain everything step by step and by the end of this piece anyone will understand what ls -l*.c does at a deep.

  • What is a terminal?
  • How do I open a terminal window?
  • How do I use the terminal?

What is it:

A terminal, also known as a terminal, command line or console is an interactive program which allows you to type commands — lines of text which are interpreted as instructions to control your computer. Terminal programs are available built-in to all major operating systems.

Why use it:

It can be much faster to complete some tasks using a Terminal than with graphical applications and menus. Another benefit is allowing access to many more commands and scripts.

A common terminal task of installing an application can be achieved within a single command, compared to navigating through the Software Centre or Synaptic Manager.

For example the following would install Deluge bittorrent client:

sudo apt-get install deluge

How do I open a terminal:

  • Open the Dash (Super Key) or Applications and type terminal
  • Use the keyboard shortcut by pressing Ctrl+Alt+T.
  • For older or Ubuntu versions: (More Info)
  • Applications → Accessories → Terminal
  • On Windows you can access a terminal on your laptop by running “Command Prompt” or cmd.exe.

Why are they called Terminals?

They are called terminals for short because they function as terminal emulators. They provide a software emulation of a physical device called a terminal such as a VT100, which looked like this…

What does ls mean?

The ls command is used to list files or directories in Linux and other Unix-based operating systems. Just like you navigate in your File explorer or Finder with a GUI, the ls command allows you to list all files or directories in the current directory by default, and further interact with them via the command line.

What is the meaning of LS in Unix?
In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory.
Source: https://ostoday.org/linux/question-what-does-ls-mean-in-linux.html

What is LS in terminal?
Type ls into Terminal and hit Enter. ls stands for “list files” and will list all the files in your current directory. … pwd This command means “print working directory” and will tell you the exact working directory you are currently in.
Source: https://ostoday.org/linux/question-what-does-ls-mean-in-linux.html

Long Listing Format

The default output of the ls command shows only the names of the files and directories, which is not very informative.

The -l ( lowercase L) option tells ls to print files in a long listing format.

When the long listing format is used, you can see the following file information:

Total: show total size of the folder.
File type: First field in the output is file type. …
Owner: This field provide info about the creator of the file.
Group: This filed provide info about who all can access the file.
File size: This field provide info about the file size.
Source: https://ostoday.org/linux/question-what-does-ls-mean-in-linux.html

drwxr-xr-x   6 eva        users         1024 Jun  8 16:46 sabon
-rw------- 1 eva users 1564 Apr 28 14:35 splus
-rw------- 1 eva users 1119 Apr 28 16:00 splus2
-rw-r--r-- 1 eva users 9753 Sep 27 11:14 ssh_known_hosts
-rw-r--r-- 1 eva users 4131 Sep 21 15:23 swlist.out
-rw-r--r-- 1 eva users 94031 Sep 1 16:07 tarnti.zip

What does ls -l*.c do?

The ‘*’ aka wildcard expansion is a way of telling the Linux operating system to find ALL of a certain criteria. Very rarely does a programmer ask to see ALL without defining something specific so instead it is often paired with a file extension such as .jpg (the file extension for pictures) or .js (Javascript files).

If a programmer was to type ls -l*.c the computer would interpret this as find all files in the current directory in the form of long format that have a .c (C programming language) file extension.

In conclusion there are so many commands that you can use to solve problem with Linux and other operating systems.

If you want to learn more “https://man7.org/linux/man-pages/man1/ls.1.html

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Arafat Mamia
Arafat Mamia

Written by Arafat Mamia

0 Followers

I’m Arafat Mamia

No responses yet

Write a response