First of all, when working with any file of file that starts with a dash, that poses a small problem because a dash is used to denote options (like Vi's -r option) and so won't be taken as a filename. The simplest workaround for this case is to just prefix it with a ./
as in vi ./-z
will open the "-z" file in vi without issue. Another common workaround with most software it to put file names after an argument of --
. That is a common separator most software accepts to separate options from non-option arguments like filenames. So, the other approach is to use vi -- -z
. The ./
trick should always work, but --
can be depend on the software to implement it, but it is quite common.
As for that file itself, I would think it's more likely something that was accidentally created when attempting to pass a -z
option to it for whatever reason, but it was taken as a filename, possibly because it was given passed a --
or a >
parameter. If you are concerned about it's contents, a safer option to examine it might be a program like hexdump -C
or xdd
. As you said you have opened it in Vim, it's not too likely it would cause any harm. If you see a bunch of ^@
symbols in Vim, that means the NUL
control character which is just a byte of value zero. That could be from a variety of sources from allocating a file without writing any contents to it to being an empty disk image or similar. If that's all that's in that file, it's basically empty with no real contents.
sudo vim -- -z
doesn't work? – rusty Feb 25 '24 at 14:51^@
. – Soda Party Feb 25 '24 at 18:03file
command could reveal its origin? I don't know whether it's a good idea to touch it or not, I'm just observing. – Levente Feb 25 '24 at 18:46file
only outputsvirus: data
(renamed-z
tovirus
) – Soda Party Feb 25 '24 at 19:05sudo vim -- -z file
while you intended to dosudo vim -Z -- file
or something similar? – Raffa Feb 25 '24 at 19:28^@
, then the file is completely filled with *zeroes*. Even viruses need data at the beginning of the file to know how to run. Raffa's hypothesis of you accidentally saving an argument as a file is more likely – Daniel T Feb 25 '24 at 22:52vim ./-z
– phuclv Feb 26 '24 at 02:54