Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jun 2000 14:13:41 -0700
From:      Matthew Hunt <mph@astro.caltech.edu>
To:        Pedro Hernandez <pedro@hci.com.mx>
Cc:        FreeBSD Questions List <questions@FreeBSD.ORG>
Subject:   Re: Erasing files ...
Message-ID:  <20000630141341.A11964@wopr.caltech.edu>
In-Reply-To: <NDBBLDLJFKMIDBKILPEPMECMCIAA.pedro@hci.com.mx>; from pedro@hci.com.mx on Fri, Jun 30, 2000 at 04:07:30PM -0600
References:  <NDBBLDLJFKMIDBKILPEPMECMCIAA.pedro@hci.com.mx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 30, 2000 at 04:07:30PM -0600, Pedro Hernandez wrote:

> How can I delete a file named "-z" from root file system ?

You can use the '--' flag to rm, which tells it that there are
no more flags, and everything else is a filename:

wopr:~/tmp$ ls -l
total 2
-rw-rw-r--  1 mph  mph     0 Jun 30 14:10 -z
drwxr-xr-x  3 mph  mph  1024 Jun 28 19:11 pictures/
wopr:~/tmp$ rm -- -z
wopr:~/tmp$ ls -l
total 2
drwxr-xr-x  3 mph  mph  1024 Jun 28 19:11 pictures/

Or, explicitly specify a path so that the first character isn't
a hyphen:

wopr:~/tmp$ ls -l
total 2
-rw-rw-r--  1 mph  mph  -    0 Jun 30 14:10 -z
drwxr-xr-x  3 mph  mph  - 1024 Jun 28 19:11 pictures/
wopr:~/tmp$ rm ./-z
wopr:~/tmp$ ls -l
total 2
drwxr-xr-x  3 mph  mph  1024 Jun 28 19:11 pictures/

-- 
Matthew Hunt <mph@astro.caltech.edu> * UNIX is a lever for the
http://www.pobox.com/~mph/           * intellect. -J.R. Mashey


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000630141341.A11964>