You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

find命令的-size 100k参数使用千字节还是千二进制字节?

Understanding find's -size Unit Confusion

Great question—this is a super common pain point thanks to overlapping terminology between traditional Unix conventions and modern unit standards. Let’s break this down clearly:

The Short Answer

The find command’s -size k option actually uses 1024 bytes (what’s now formally called a kibibyte, KiB), even though the man page incorrectly labels it as a "kilobyte" (which should be 1000 bytes). This is a historical terminology holdover, not a functional bug.

How to Verify It Yourself

You can easily test this behavior with a couple of quick commands:

  • Create a file exactly 1024 bytes long:
    dd if=/dev/zero of=test-1024b bs=1 count=1024
    
  • Create a file exactly 1000 bytes long:
    dd if=/dev/zero of=test-1000b bs=1 count=1000
    
  • Now run find with the -size 1k filter:
    find . -size 1k
    
    This will only return test-1024b, confirming that k maps to 1024 bytes.

What About 1000-byte "Kilobytes"?

Many modern versions of find (like GNU find, the default on most Linux distros) support a uppercase K to explicitly denote 1000-byte units. If you run:

find . -size 1K

It will only return test-1000b, aligning with the formal kilobyte definition.

Why the Man Page is Wrong

This mismatch comes from history: When Unix tools like find were first written, the term "kilobyte" was commonly used to mean 1024 bytes, long before the IEC introduced the kibibyte (KiB) and mebibyte (MiB) terms to distinguish binary vs decimal units. Most man pages haven’t been updated to reflect this modern terminology standard, leading to the confusion you noticed.

内容的提问来源于stack exchange,提问作者user3002473

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:27:32