[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to delete a file called "-gzip"?



on Mon, Feb 05, 2001 at 11:29:39PM +0100, Kerstin Hoef-Emden (Kerstin.Hoef-Emden@Uni-Koeln.DE) wrote:
> 
> Hi,
> 
> this is a completely stupid thing I did. I wanted to make a zipped tar
> archive of my complete user home account and write it to MOD. 
> 
> Unfortunately I used the following line:
> 
> tar -cvvf -gzip /mod/name-of-archive folder-name
> 
> Now my home-partition is 100 % full and I don´t know how to delete that
> -gzip file! :-(
> Gee, why doesn´t tar realize that things starting with "-" are no file
> names.
> 
> I tried
> rm "-gzip" 
> rm ´-gzip´
> rm \-gzip
> 
> None of these worked.
> 
> What is the trick? (There must be one ...)

As noted, '--' is the argument to many shell commands to tell them to
stop parsing options and start treating things as inputs.  This works in
this case, though for other unprintables, you're still stuck.

Best solution I've found for the general problem is to go directly to
inodes:

    $ ls -i | grep <pattern> # list files with inode
    $ find . -inum <inode> -e do something \;

This is one of many tricks in the O'Reilly _UNIX Power Tools_ book.

Cheers.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgpN3wgBxTvP_.pgp
Description: PGP signature


Reply to: