To do this, just right-hit the file and select Properties.

Alternatively, if the folder is set to detailed view mode, you may see file sizes directly there.

There are at least 3 such commands.

Article image

Valeriy Odintsov

They aredu,ls, andstat.

Lets take a detailed look at how they can be used below.

There are two main subtypes of commands.

It lists the directorys contents, including the file name, size, and permissions.

For thelscommand to display file sizes in an easy-to-read format, you should also use the-hparameter.

Lets look at how it works with a simple example.

Suppose you have the filemyfile.txt.

In fact, there is almost no difference betweenlsanddu.

However, some users have still noticed that theducommand provides data faster.

Heres how to use it.

Thats why you gotta use-cto specify the format of the output.

And%sspecifies that the file size should be displayed in bytes.

you’re free to use%kto display it in kilobytes.

I would prefer to use thelsorducommands if I only needed the file size.

They work faster and provide data in an easy-to-read format.

But if you need more information about the file, then usestat.

Anyway, its up to you.