When using rsync to copy files over the network, I give a path so that rsync will know where to put the file on the remote server.

rsync -av /home/ME/myfile user@remoteserver:/home/ME/

If I leave off the remote path, where will rsync put the file? Eg:

rsync -av /home/ME/myfile user@remoteserver

2 Answers 2

rsync -av /home/ME/myfile user@remoteserver

This command will not send the file to your remote server, it will just make a duplicate of the /home/me/myfile in your current working directory and the name of the file will be called user@remoteserver.

Just like when you want to create a backup of a file before editing it with cp, you do

cp -a /etc/fstab /etc/fstab.org

Your example of

rsync -av /home/ME/myfile user@remoteserver

has left off the colon. Without that, it assumes the file is local.

If you instead had

rsync -av /home/ME/myfile user@remoteserver:

Then it would make a remote copy. In this case the location is relative to the home directory of the user. With no relative path given, the file will appear in that directory.

$ rsync -v myfile user@remoteserver:
user@remoteservers's password: 

sent 619 bytes  received 35 bytes  145.33 bytes/sec
total size is 529  speedup is 0.81
$ ssh user@remoteserver "ls ./myfile"
user@remoteserver's password: 

You must log in to answer this question.

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