I was using pscp to copy files from a Windows machine to a Linux machine. I accidentally got the path wrong and now there are files that I can't seem to remove. I think it is because of the slashes in the name... It is telling me the file or directory doesn't exist. I am attaching a photo. Thanks!

enter image description here

  • 1
    Could this be because backslashes have to be escaped in what appears to be a Unix shell? Try quoting; rm '\home\sluddani\...'. – dhag Jun 1 '16 at 17:23
  • 1
    Why add a photo when you can copy/paste text? – garethTheRed Jun 1 '16 at 21:42

In the UNIX shell, backslashes need to be escaped or single quoted. You can remove those files with one of the following:

rm '\home\sluddani\installApps'


rm \\home\\sluddani\\installApps

| improve this answer | |

You can use the "-i" (interactive) option of /bin/rm. Of course, you need to be very careful. In this particular case I would do this:

cd && /bin/rm -i *Apps*

It is possible that "Apps" will not match anything, and in that case (being VERY careful):

cd && /bin/rm -i *

This is typically the best way to delete files that have hidden characters or are otherwise difficult to name explicitly on the command line. If matching the backslash character works with matching backslashes, it is a better solution than this one.

In both cases you will be prompted to confirm deletion- make sure you don't answer yes to files you want to keep.

| improve this answer | |

If there is a chance there is a file manager in that host you can launch it from the terminal and remove the file there.

This will run nautilus in the current directory:

nautilus .

This will save you from unintentionally remove the wrong file, or worse.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.