A look into ls ( –block-size option ) in GNU

ABOUT ls –block-size

with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'

[bash light=”true”]
$ls
info man
$ls -l
total 8
drwxr-xr-x 2 jeffrin jeffrin 4096 Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 4096 Nov 22 18:51 man
$ls -l –block-size=B
ls: invalid –block-size argument `B’
$ls -l –block-size=KB
total 9kB
drwxr-xr-x 2 jeffrin jeffrin 5kB Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 5kB Nov 22 18:51 man
$ls -l –block-size=M
total 1M
drwxr-xr-x 2 jeffrin jeffrin 1M Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 1M Nov 22 18:51 man
$ls -l –block-size=MB
total 1MB
drwxr-xr-x 2 jeffrin jeffrin 1MB Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 1MB Nov 22 18:51 man
$ls -l –block-size=T
total 1T
drwxr-xr-x 2 jeffrin jeffrin 1T Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 1T Nov 22 18:51 man
$ls -l –block-size=K
total 8K
drwxr-xr-x 2 jeffrin jeffrin 4K Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 4K Nov 22 18:51 man
$ls
info man
$ls -l
total 8
drwxr-xr-x 2 jeffrin jeffrin 4096 Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 4096 Nov 22 18:51 man
$ls -l –block-size=10MB
total 1
drwxr-xr-x 2 jeffrin jeffrin 1 Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 1 Nov 22 18:51 man
$ls -l –block-size=5MB
total 1
drwxr-xr-x 2 jeffrin jeffrin 1 Nov 22 20:39 info
drwxr-xr-x 3 jeffrin jeffrin 1 Nov 22 18:51 man
$ls -l –block-size=5 MB
ls: cannot access MB: No such file or directory
$ls -l –block-size=MB 5
ls: cannot access 5: No such file or directory
$
[/bash]

KNOWLEDGE

In computing (specifically data transmission and data storage), a block, sometimes called a physical record, is a sequence of bytes or bits, usually containing some whole number of records, having a maximum length, a block size.[1] Data thus structured are said to be blocked. The process of putting data into blocks is called blocking, while deblocking is the process of extracting data from blocks. Blocked data is normally stored in a data buffer and read or written a whole block at a time. Blocking reduces the overhead and speeds up the handling of the data-stream.[2] For some devices, such as magnetic tape and CKD disk devices, blocking reduces the amount of external storage required for the data. Blocking is almost universally employed when storing data to 9-track magnetic tape, NAND flash memory, and rotating media such as floppy disks, hard disks, and optical discs.

LINK
http://man7.org/linux/man-pages/man1/ls.1.html
https://en.wikipedia.org/wiki/Block_(data_storage)
https://www.gnu.org/software/coreutils/manual/html_node/Block-size.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s