I already have a working command to copy a file between different virtual machines.

But I want the copied file to automatically have the same filename as the original file. So I want to create a script for picking up the original filename and maintain the same filename for the copied file. That is all.

If it is relevant, and I do not think it is relevant, the command to copy between different virtual machines is:

cat /path/to/file_in_dom0 | qvm-run --pass-io <dst_domain> 'cat > /path/to/file_name_in_appvm'

This command was copied from here

  • 2
    Any reason to not directly copy the files with scp from one virtual machine to the other?
    – Anthon
    Commented Sep 14, 2014 at 12:59
  • This is Qubes-os, a linux-xen environment directed to security, so most common options are disabled for security reasons. The above reported command is the only one that works.
    – Fran
    Commented Sep 14, 2014 at 18:28

1 Answer 1


The idea is to archive the file, pipe the archive to the other side, which unarchives its standard input. Something like:

tar cf - /path/to/file_in_dom0 | qvm-run --pass-io <dst_domain> 'cd / && tar xf -'

This will preserve the full pathname. If you do not want that, you can do something similar in a script, and use the dirname, basename and cd commands to do exactly what you want.

Note: I've used tar because it is standard under Unix, but other archivers may be able to do similar things. And you can do this to copy several files with a single command.

You must log in to answer this question.

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