Why file size appears to change when you move a file from one Unix-like system to another

On Unix-like (that is, Linux) systems, the ls -s and du commands both report the size of files in blocks. However, the length of a block can differ between operating systems. For example, in some Unix-like operating systems, blocks are 512 bytes long; in others, blocks are 1 kilobyte (KB) long.

Some Unix-like systems that restrict the amount of storage space their users can have measure storage space in bytes rather than blocks. If you move a file from such a system to one that measures storage capacity in blocks, the du and ls -s commands will report a file size different from the one reported on the previous system; however, this does not mean the file size has actually changed.

On UITS research supercomputers at Indiana University, the du and ls -s commands both report file sizes in 1-KB blocks.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Research computing support at IU is provided by the Research Technologies division of UITS. To ask a question or get help regarding Research Technologies services, including IU's research supercomputers and research storage systems, and the scientific, statistical, and mathematical applications available on those systems, contact UITS Research Technologies. For service-specific support contact information, see Research computing support at IU.

This is document aatv in the Knowledge Base.
Last modified on 2023-08-04 14:51:08.