When I move a file from one Unix-like system to another, why does the file size appear to change?

On Unix-like (i.e., 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 a 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 computing systems 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 At IU, how do I get support for Linux or Unix?

Support for IU research computing systems, software, and services is provided by the Research Technologies division of UITS. To ask a question or get help, contact UITS Research Technologies.

This is document aatv in the Knowledge Base.
Last modified on 2017-05-16 11:52:45.

Contact us

For help or to comment, email the UITS Support Center.