sudo rm (filename with spaces between two words)

Andy Goh (hantu) hantuvii at gmail.com
Wed Oct 25 00:02:31 BST 2006


.. or you could escape the space, using '\'

ie. sudo rm this\ is\ pretty\ annoying.ext

On 10/25/06, Peter Garrett <peter.garrett at optusnet.com.au> wrote:
>
> On Tue, 24 Oct 2006 11:59:56 -0400
> smithveg <smithveg at gmail.com> wrote:
>
> > Hello,
> >
> > Normally, i just use the 'sudo rm filenames' to delete a file. But i can
> not
> > delete a filename like 'file to you.odt'
> > When i try to create launcher in desktop, i can noticed the command also
> > have the space inthe filename. But if i write in terminal, it prompt me
> file
> > not found.
> >
> > sudo rm file to you.odt ---> can not find the file. Why?
>
> Linux/Unix doesn't like spaces in file names :) You can usually
> tab-complete the name like this:
>
> sudo rm file <tab>
>
> or, you can put the file name in quotes like:
>
> sudo rm "file to you.odt"
>
> There is a reason for this, if you think about it - commands, options and
> arguments are separated with spaces on the command line, so it's tricky
> for the bash shell to guess which spaces meant what.... If there is a
> space
> it assumes the next word is a file name, so it interprets  file to you as
> 3
> files ( file , to, you ) . Since those files don't exist, it complains ;-)
>
> When creating files I usually separate words using dots - like
> file.to.you.odt . You might prefer to use underscores, or hyphens.
>
> Peter
>
> --
> ubuntu-au mailing list
> ubuntu-au at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-au
>



-- 
- nd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-au/attachments/20061025/7b8742df/attachment.htm 


More information about the ubuntu-au mailing list