On Tue, Jun 29, 2021 at 9:06 PM Michael Barnes <barnmich...@gmail.com> wrote:
> On Tue, Jun 29, 2021 at 7:47 AM Paul Heinlein <heinl...@madboa.com> wrote: > > > On Tue, 29 Jun 2021, Michael Barnes wrote: > > > > > Somehow, I managed to create a file named -u. I cannot figure out how > to > > > look at it as any command I give thinks -u is an option, not the > > filename. > > > > > > I cannot read, edit, move, delete, or anything. > > > > > > Ideas appreciated. > > > > Most GNU utilities will stop interpreting options when they encounter > > a bare ' -- ' string. So this should work > > > > mv -- -u newfilename > > > > Or, just use the . directory in the filename: > > > > less ./-u > > > > -- > > Paul Heinlein > > heinl...@madboa.com > > 45.38° N, 122.59° W > > > Paul got it, although I figured it out about ten minutes after I sent my > request. > less ./-u did the trick. > > Thanks, > Michael > This actually comes up so often that there's a section in the man page about it: $ man rm | cat -n | grep -B1 -A5 starts 56 57 To remove a file whose name starts with a '-', for example '-foo', use one of these commands: 58 59 rm -- -foo 60 61 rm ./-foo 62 Regards, - Robert