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 various UITS Research Technologies units. For help, see Research computing support at IU.

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

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.