What Does ls -l Command Do in Linux

3

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401721 710 What Does ls l Command Do in Linux

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.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401722 825 What Does ls l Command Do in Linux

Sorting

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401722 265 What Does ls l Command Do in Linux

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

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401723 857 What Does ls l Command Do in Linux

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

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401724 531 What Does ls l Command Do in Linux

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401724 781 What Does ls l Command Do in Linux

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.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401725 909 What Does ls l Command Do in Linux

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401726 606 What Does ls l Command Do in Linux

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401726 758 What Does ls l Command Do in Linux

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”.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401727 574 What Does ls l Command Do in Linux

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.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401727 967 What Does ls l Command Do in Linux

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.

What Does ls -l Command Do in Linux What Does ls -l Command Do in Linux 1633401728 951 What Does ls l Command Do in Linux

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