I want to tar a file whose name id : -i_jkhv34
but I am getting an error :
tar: invalid option -- '_'
is there any way to do so?
You can do this to prevent tar
from seeing a parameter beginning with -
tar cf foo ./-i_jkhv34
(assuming you want the archive to be named foo
).
Backslash (\
) will only be seen by the shell, not by tar
.
Some implementations of tar
provide other ways to specify filenames (there is no standard for tar
, by the way). For instance, GNU tar
provides a -T option for specifying filenames in a file. The bsdtar
program also does this.
-
using\
exampletar ... \-i_jkhv34