How to display the file size in megabytes with ls in linux/unix

Display the file size in megabytes, which can facilitate us to browse the file storage size.

Usually, when we use the ls command, the file size shows the number of bytes of the file, which is very unfavorable for us to read.

For example, when we use the ls -l long format option:

➜  ~ ls -l

Fortunately, the ls command provides us with a very friendly option:

  • -h
    It is used with the -l option to display the file size in bytes, kilobytes, megabytes, gigabytes…

The following command:

➜  ~ ls -lh

More recommended articles:

How to sort by size, type, time, name using linux ls command
view linux file change time, modify time and access time, use linux stat or ls

Add a Comment

Your email address will not be published. Required fields are marked *