Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GCLOUD_COMPUTE_COPY-FILES (1)


gcloud compute copy-files - copy files to and from Google Compute Engine virtual machines



gcloud compute copy-files [[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC ...] [[USER@]INSTANCE:]DEST [--dry-run] [--plain] [--ssh-key-file SSH_KEY_FILE] [--zone ZONE] [GLOBAL-FLAG ...]


gcloud compute copy-files copies files between a virtual machine instance and your local machine.

To denote a remote file, prefix the file name with the virtual machine instance name (e.g., example-instance:~/FILE). To denote a local file, do not add a prefix to the file name (e.g., ~/FILE). For example, to copy a remote directory to your local host, run:

$ gcloud compute copy-files example-instance:~/REMOTE-DIR \
~/LOCAL-DIR --zone us-central1-a

In the above example, ~/REMOTE-DIR from example-instance is copied into the ~/LOCAL-DIR directory.

Conversely, files from your local computer can be copied to a virtual machine:

$ gcloud compute copy-files ~/LOCAL-FILE-1 ~/LOCAL-FILE-2 \
example-instance:~/REMOTE-DIR --zone us-central1-a

If a file contains a colon (‘‘:’’), you must specify it by either using an absolute path or a path that begins with ‘‘./’’.

Under the covers, scp(1) is used to facilitate the transfer.

When the destination is local, all sources must be the same virtual machine instance. When the destination is remote, all source must be local.

This command ensures that the user’s public SSH key is present in the project’s metadata. If the user does not have a public SSH key, one is generated using ssh-keygen(1) (if the the --quiet flag is given, the generated key will have an empty passphrase).



Specifies a source file.

Specifies a destination for the source files.



If provided, prints the command that would be run to standard out instead of executing it.

Suppresses the automatic addition of ssh(1)/scp(1) flags. This flag is useful if you want to take care of authentication yourself or re-enable strict host checking.

--ssh-key-file SSH_KEY_FILE
The path to the SSH key file. By default, this is ~/.ssh/google_compute_engine.

--zone ZONE
The zone of the instance to copy files to/from. If omitted, you will be prompted to select a zone.

If not specified, you will be prompted to select a zone.

To avoid prompting when this flag is omitted, you can set the compute/zone property:

$ gcloud config set compute/zone ZONE

A list of zones can be fetched by running:

$ gcloud compute zones list

To unset the property, run:

$ gcloud config unset compute/zone

Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.


Run $ gcloud help for a description of flags available to all commands.

Search for    or go to Top of page |  Section 1 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.