cat shows nothing
Your file is full of nulls, rather than empty. A regular cat
will print the nulls to standard output, but your terminal will generally display them each as nothing, while cat -v
represents them as ^@
. ^@
represents a null byte because the byte value of "@" (0x40, or 64) xor 64 (flip bit 7) is zero.
Why it's suddenly full of nulls, we can't tell from here.
This related question may be informative about the caret representation: Are ASCII escape sequences and control characters pairings part of a standard?
Be careful , cat is not the perfect tool to display data that can be binary.
A simple unix tool is od ( octal dump ).
A example of od -c -tx1
root@server:~# od -c -tx1 /etc/passwd | head
0000000 r o o t : x : 0 : 0 : r o o t :
72 6f 6f 74 3a 78 3a 30 3a 30 3a 72 6f 6f 74 3a
0000020 / r o o t : / b i n / b a s h \n
2f 72 6f 6f 74 3a 2f 62 69 6e 2f 62 61 73 68 0a
0000040 d a e m o n : x : 1 : 1 : d a e
64 61 65 6d 6f 6e 3a 78 3a 31 3a 31 3a 64 61 65
0000060 m o n : / u s r / s b i n : / u
6d 6f 6e 3a 2f 75 73 72 2f 73 62 69 6e 3a 2f 75
0000100 s r / s b i n / n o l o g i n \n
73 72 2f 73 62 69 6e 2f 6e 6f 6c 6f 67 69 6e 0a
so you can see that the carriage return \n