Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Kibibytes to Kilobytes

Kibibytes to Kilobytes

Restate the KiB figures that du, df, ls and /proc print as decimal KB, with a table of real command output and the 1.024 factor worked through.

Reading Linux Size Output in KiB and Reporting It in KB

Almost every size a Linux shell prints is a kibibyte figure, even when the column header says "K" or "kB". du -k, df -k, ls -l --block-size=K and every counter in /proc count blocks of 1024 bytes. The moment that number leaves the terminal — into a capacity report, a vendor ticket, a spreadsheet somebody outside the team will read — it usually has to be restated in decimal kilobytes of 1000 bytes. That restatement is what this page does.

The factor: 1 KiB = 1024 bytes and 1 KB = 1000 bytes, so KB = KiB × 1.024. A du -sk /etc that prints 1480 is 1480 × 1.024 = 1 515.52 KB.

The -k Flag Is Not Decimal

In GNU coreutils, -k means "report in units of 1024 bytes". The letter is inherited from an era when nobody distinguished the two scales, and the output has never been changed to match SI.

One File, Two Legitimate Numbers

A file has an apparent size — the bytes it contains — and a disk usage, the blocks the filesystem handed it. ls shows the first, du the second, and neither of them is wrong.

/proc Speaks Only in KiB

The kernel exposes MemTotal, SwapTotal and the fields in /proc/swaps as bare kB-labelled integers that are in fact kibibytes — eight-digit numbers where a 2.4% gap runs to thousands of kilobytes.

Where the 2.4% Actually Bites

On a 12 KiB config file the gap is 288 bytes and nobody cares. On a df -k figure for a large volume it is several decimal gigabytes, which is enough to make two capacity reports contradict each other.

Turning a Terminal Figure Into Kilobytes

1

Paste the Number the Shell Printed

Drop the integer from du -k, df -k or /proc/meminfo straight into the KiB field. Stray spaces are ignored, and a comma is accepted as a decimal point if your locale produced one.

2

Read the Decimal Kilobyte Value

The KB field updates as you type, with thousands separated by a space so an eight-digit /proc figure stays legible. Fractional results are shown to eight decimals.

3

Copy the Bare Number Into the Report

The copy button beside each field puts the plain digits on your clipboard — no unit suffix, no grouping — which is what a ticket field, a CSV column or a shell variable expects.

4

Reverse It When You Are Checking a Claim

Going the other way is one click: the swap button turns the page into a KB → KiB converter, so a decimal figure from a datasheet or a monitoring dashboard can be restated in the units the shell will actually show you.

Both unit menus are searchable and list every data-storage unit, so the same /proc value can be pushed on to MiB, GiB or plain bytes without leaving the page.

What Each Linux Command Actually Reports

The table below takes figures of the kind these commands print on an ordinary server and restates each one in decimal kilobytes. The first two rows describe the same class of small file measured two different ways — allocation versus content — which is the single most common source of "the two commands disagree" tickets.

CommandWhat the number meansKiBKB
du -k script.shBlocks allocated to a tiny script44.096
ls -l --block-size=K app.logApparent size of a small log1212.288
du -sk /etcRecursive total of a config tree1 4801 515.52
df -k /bootFree space on a small partition262 144268 435.456
cat /proc/swapsConfigured swap size2 097 1522 147 483.648
grep MemTotal /proc/meminfoInstalled memory seen by the kernel16 316 04816 707 633.152

Built for Shell Output

Paste Straight From the Prompt

Numbers arrive from a terminal with whatever spacing the column formatting gave them; the input strips spaces and accepts either decimal separator rather than refusing the value.

Eight-Digit /proc Values Stay Readable

Output is grouped with a space every three digits, and values at or beyond ten billion switch to scientific notation instead of running off the end of the field.

Clipboard Output a Script Can Eat

Copying yields the raw number with no unit and no grouping, so it can be pasted into a monitoring threshold or a spreadsheet cell without any cleanup first.

Any Storage Unit on Either Side

Both dropdowns are searchable and cover bits, decimal units, IEC binary units and transfer-rate units, so one df figure can be expressed in whatever the audience uses.

Questions From the Terminal

Why does du report a different number than ls -l for the same file?

They answer different questions. ls -l reports the apparent size — how many bytes the file contains. du reports how much space the filesystem actually gave it, counted in whole allocation units. A 900-byte script contains 900 bytes but occupies a full unit on disk, so du -k says 4 KiB while ls says 900. Convert whichever one your report is about, and state which one it is.

What does the -k in du -k and df -k actually count?

Units of 1024 bytes — kibibytes — despite the letter K suggesting a thousand. That is why a partition df -k calls 262 144 is 268 435.456 KB in decimal terms. If you are quoting the figure to someone outside the shell, multiply by 1.024 and label it KB, or leave it labelled KiB and let them convert.

Why does du --block-size=KB disagree with du --block-size=K?

Because coreutils treats the two suffixes as genuinely different scales. A bare K (like M and G) means the 1024-based unit, while the two-letter KB form means the 1000-based one. Ask for --block-size=KB and du does the ×1.024 arithmetic for you — but it also rounds up to whole units, so wherever the fraction matters, take the KiB figure and convert it here instead.

Which option makes du print the logical size instead of the space on disk?

--apparent-size. Combined with -k it gives you the content length rounded up to kibibytes rather than the allocated blocks, which is the number that matches what ls -l shows. It is the right choice when you are estimating how much data a transfer will move; the default block accounting is the right choice when you are asking how full the volume is.

A preallocated database file looks huge in ls but tiny in du — which number should I convert?

That is a sparse file: regions that were never written are recorded as holes rather than stored, so the apparent size is large while the consumed blocks are few. Convert the du figure when you are reporting capacity consumed, and the ls figure when you are sizing a copy or a backup — a naive copy expands the holes into real bytes and lands much closer to the apparent size.

KiB
KB

Linux Command Output

4 KiB=4.096 KB
12 KiB=12.288 KB
1,480 KiB=1,515.52 KB
262,144 KiB=268,435.456 KB
2,097,152 KiB=2,147,483.648 KB
16,316,048 KiB=16,707,633.152 KB

Kibibyte (KiB)

The unit hiding behind the -k flag in du and df and behind every kB label in /proc: 1024 bytes, counted in whole blocks.

Kilobyte (KB)

1000 bytes — the scale capacity reports, vendor documents and anything outside the shell expect to read.

Paste a raw du or df figure — spaces are ignored and a comma works as a decimal point
The copy button on each field returns the bare number, ready for a ticket or a spreadsheet cell
Press swap to run KB → KiB when checking a vendor figure against what the shell will show
Both unit menus are searchable, so a /proc value can go straight on to MiB, GiB or bytes
Want to learn more? Read documentation →
1/5
Start typing to search...
Searching...
No results found
Try searching with different keywords