If I create a file in ubuntu like this: “echo “asd” > file.txt” and I do a ls -l file.txt it says that it’s size is 4 bytes, but I only wrote 3 (asd). If I do “cat file.txt” it shows the 3 chars that I have added. Why is the file 4 bytes large?
Share
asd+ new line character = 4 bytes-n in echo switches newline off
hdshows you a hexdump of the stream. You see the0acharacter at the end. That is the fourth character, newline.