What Does ls -l Command Do in Linux


In Linux, the ls command is without doubt one of the elementary gear. It lists information and directories without or with quite a lot of additional info. The ls command is part of the GNU core software bundle. It must be to be had on any Linux distro.

This information will exhibit find out how to use the ls command, in particular “ls -l” together with different choices.

Linux ls command

The ls command takes the positioning of a listing and prints the entire information and directories inside the location. It too can print further record knowledge like record permissions, record possession, record dimension, and so on.

Command construction

This is the command construction that each one ls instructions will have to observe.

$ ls choices> listing>

If no listing is specified, then ls plays its motion at the present listing. For instance, the next command will listing the entire information and directories (title handiest).

Listing information and directories in lengthy listing structure

By default, the ls command will print the title of the entire information and directories handiest. To get the extra knowledge and a cleaner view, use the flag “-l”.

In lengthy listing structure, ls presentations the next data about every record.

Additional choices

There are a lot of choices to be had to switch the output of the ls command. All the next choices are blended with “ls -l” to make use of the lengthy listing structure via default.

Showing backslash after directories

By default, the ls command makes use of coloring to tell apart between information and directories. However, it is probably not dependable in quite a lot of scenarios; for instance, you’re having access to via a console that doesn’t strengthen coloring.

In this type of scenario, use the flag “-F” to turn a backslash “/” after the title of a listing.


The ls command will display the listing in a selected order (usually via record title in alphabetic order). However, it additionally helps sorting in response to different values.

To type the output in opposite order, use the flag “-r”.

To type the information and directories via time and date of advent/amendment, use the flag “-t” as an alternative.

We too can type the output alphabetically via access extension. To achieve this, use the flag “-X”.

Showing hidden information

By default, the ls command received’t display hidden information. These are the information that get started with “.” originally of the record title.

To display the hidden information, use the flag “-a”.

Directory tree

A listing tree presentations the hierarchy of the objective listing and its sub-directories and information. Generally, we use the tree command to test the listing tree.

However, the ls command too can exhibit the listing tree (despite the fact that not-so-good-looking). To print the tree view, use the flag “-R”.

Showing inode quantity

In Linux, every record has its distinctive inode worth. Inode shops metadata for each and every unmarried record at the partition. These knowledge are saved firstly of every partition. It shops the entire record data with the exception of the record title and the information itself.

To display the inode worth of every record and directories, use the flag “-i”.

Showing UID and GID

In Linux, every record has its UID (distinctive identifier) and GID (crew ID). To display the UID and GID of the information, use the flag “-n”.

Human-readable structure

By default, the ls command prints record dimension in bytes. We can inform to print the entire values in human-readable structure for more uncomplicated figuring out of them.

More choices

These are just a handful of choices that the ls command helps. For the total listing of supported choices in addition to detailed explanations, take a look at the person web page.

Final ideas

In this information, we discovered in regards to the ls command in Linux. It’s one of the most elementary gear to be had on all Linux distros. This information showcases many commonplace strategies of the usage of the ls command. Once mastered, it may be extra handy to make use of it than a GUI record browser.

Happy computing!

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More