WriteBash - 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.
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
dthen the type is the directory.
l: value is
lthen 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.If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.