In short, du (disk usage), list the size actually that file occupied, system use block to store data, each block is 4k, so even if you have a 10 bytes file, it will still use 4k disk usage, so du file shows 4k. But if you use ls -l, it shows 10 bytes.
Create file
~/Learning/Programming/C_Cpp on main +1 !1 ?5 at 04:40:25 PM ─╮❯ dd if=/dev/zero of=./test bs=1040 count=1 ─╯1+0 records in1+0 records out1040 bytes (1.0 kB, 1.0 KiB) copied, 0.00037525 s, 2.8 MB/s
ls -l
~/Learning/Programming/C_Cpp on main +1 !1 ?5 at 04:40:42 PM ─╮❯ ls -l test ─╯.rw-r--r-- 1.0k coolder 8 Oct 16:40 test
du -sh
~/Learning/Programming/C_Cpp on main +1 !1 ?5 at 04:41:22 PM ─╮❯ du -sh test ─╯4.0K test
