I was attempting to utilize the mv command to move a file onto a remote server. I ended up executing the command...

mv sqlreport.php [email protected]

Unfortunately, this did not work. Worse, my file seems to have disappeared. A new file, [email protected], has appeared, but it is not a directory (In that I cannot cd into it).

Any tips on where my file may have gone, and how to rescue it?

  • 6
    You went wrong in that mv is not capable of moving a file to a remote location. You will need something like curl or scp.
    – HalosGhost
    Jun 24, 2014 at 5:17
  • 4
    @Bernhard, I did not mean to (nor do I feel that I did) imply that either curl or scp were 1:1 replacements for mv using the syntax the OP used. They are, however, tools that can be used for what the OP wants.
    – HalosGhost
    Jun 24, 2014 at 6:01
  • 32
    "Worse, my file seems to have disappeared. A new file, [email protected], has appeared" What MIGHT be the content of that file? Don't you want to guess?
    – glglgl
    Jun 24, 2014 at 14:02
  • 2
    @CarlWitthoft: Well, when you "rename", you are just "moving" the file to a new one with a new name :D
    – gen_Eric
    Jun 24, 2014 at 17:08
  • 3
    The new file is not a directory? Impressive. Was the old file a directory? Jun 25, 2014 at 15:06

4 Answers 4


You have renamed your file to [email protected].Try renaming it back:

mv [email protected] sqlreport.php
  • 2
    There's no need to quote the filename with the @ in it. (There wasn't when it was moved to that filename.) Jun 24, 2014 at 21:16

Your file is not vanished,You have just renamed it. You can rename it back to sqlreport.php using the following command mv [email protected] sqlreport.php. To copy your file to remote host you can use the scp command. scp sqlreport.php [email protected]:/remote/directory/path. If you want to copy a directory to remote host then you can use -r option suffix to scp.

  • 1
    And while we're at it: You need to put at least a colon at the end of the remote target (useful for copying something to a remote home directory) or scp works just like cp. Happens to me all the time and I always wonder briefly why my file isn't there.
    – musiKk
    Jun 24, 2014 at 19:51

The key insight is that, in Unix, a filename can contain any character at all, except for '/' and the null character. So, when you type mv file user@host, it moves file file to file user@host, even though the new name contains funny characters such as '@' and '.'.

(As per MvG's comment, things get a little more complex in the brave new world of Unicode but, for 8-bit character sets, the above remains true.)

  • 2
    Better make that “any byte at all”, since the interpretation as characters depends on locale. In some encodings, UTF-8 for example, there might even be byte combinations which don't correspond to characters.
    – MvG
    Jun 24, 2014 at 14:54
  • 2
    Yep. As far as the kernel is concerned, pathnames are arbitrary strings of bytes, and the only bytes with any defined meaning are 0x2f (ASCII /, component separator) and 0x00 (end of C-string). Defining a general mapping of these byte sequences to character sequences is entirely user space's problem. (Some filesystems, e.g. NTFS, impose more complicated rules, coming as they do from OSes with more complicated pathname semantics.)
    – zwol
    Jun 24, 2014 at 15:17
  • @Zack still, even in NTFS there's a POSIX name subsystem.
    – Ruslan
    Jun 25, 2014 at 15:21

In your case your file got renamed to [email protected]

Try using scp to copy the file to remote location

Not the answer you're looking for? Browse other questions tagged .