rsync - 收件人上的文件大 8 个字节

Ian*_*ing 1 ssh rsync scp

我有一个文件,我尝试通过 scp 和 rsync 跨有线 LAN 传输,两者都产生了相同的结果。当我du file在传输后运行文件时,接收方主机上的文件大 8 个字节。

我还检查head file | hexdump -C了两个主机,它们是相同的。同样的故事tail...

任何想法为什么会发生这种情况?如果重要,该文件是 gzip。

roa*_*ima 5

du file不是测量文件大小的合适方法。甚至手册页的第一行都写着“du -估计文件空间使用情况”(我的斜体)。

相反,使用以下一种或多种方法(其他方法也会存在):

ls -l file       # byte size should be the same on both sides
cksum file       # checksum should be same result on both sides
md5sum file      # checksum should be same result on both sides
stat -c %s file  # byte size should be same result on both sides
Run Code Online (Sandbox Code Playgroud)