Understand long format of ls command in Linux

by Daniel Pham
Published: Updated:
This entry is part 5 of 6 in the series Linux commands: Part 3 - Exploring the system

This article will help you understand the long format of ls command. You may already know the ls command in Linux is used to display content in a directory.

Understanding long format will help you in some work situations. For example, you need to check the permissions of the files contained in a directory, or you want to check the timestamps of files in the directory.

“-l” option of ls command

If you remember in the previous article, the ls command when using the -l option (ie long format) will display the list result in the form of long format.

Now, see the example below. I use the ls command to display the content in the writebash.com directory.

understand long format of ls command in linux
“ls” command with “-l” option to display results in long format.

I use ls with 2 ways, ls command does not have any options and ls command with -l option. You see the results displayed in different terminal windows very clearly.

Understand long format of ls command

Now we will explore each column of information in the long format of the ls command. What does that column mean?

drwxr-xr-x : show file or directory permissions.

  • First character: the first character in this column indicates the type of file. This character is in 1 of 3 values.
    • - : the first character is - then the type is the file.
    • d : value is d then the type is the directory.
    • l : value is l then the type is the link. You can read more about links in Linux.
  • The next 3 characters rwx: show file owner permissions.
    • r : shows file read permission.
    • w : write permission of file.
    • x : show execute permission of file.
  • Next 3 characters r-x : show file group permissions.
  • The last 3 characters r-x : displays the permission of the user other for the file.

So now that you look at the image above, you can understand that hello_world is a file and the pathname is a directory.

2 : file’s number of hard links.

trungdung : this is username of the file’s owner. In this case, my username is trungdung.

trungdung : the name of the group which owns the file. My username and group has the same name.

4096 : this display size of the file in bytes.

Jan 19 11:44 : show data and time of the files last modification.

pathname : name of the file or name of the directory.


For this article, you can understand what information columns mean when displaying the long format of the ls command. Believe me, it’s quite useful in some work requirements.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating
Series Navigation«« Previous part: Create links with ln commandNext part: Understand system directories on Linux systems »»

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

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

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.