I would recommend tar. When the file trees are already similar, rsync performs very well. However, since rsync will do multiple analysis passes on each file, and then copy the changes, it is much slower than tar for the initial copy. This command will likely do what you want. It will copy the files between the machines, as well as preserve both permissions and user/group ownerships.
tar -c /path/to/dir | ssh remote_server 'tar -xvf - -C /absolute/path/to/remotedir'
As per Mackintosh’s comment below this is the command you would use for rsync
rsync -avW -e ssh /path/to/dir/ remote_server:/path/to/remotedir
Related Posts:
- scp from Linux to Windows
- Copying a large directory tree locally? cp or rsync?
- What limits the maximum number of connections on a Linux server?
- Why is TCP accept() performance so bad under Xen?
- Transfer 15TB of tiny files
- Chmod 777 to a folder and all contents [duplicate]
- Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
- Amazon Linux: apt-get: command not found
- How do I find all files containing specific text on Linux?
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- How can I recursively find all files in current and subfolders based on wildcard matching?
- Linux: ‘Username’ is not in the sudoers file. This incident will be reported
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- Shell command to tar directory excluding certain files/folders
- QEMU: /bin/sh: can’t access tty; job control turned off
- Explaining the ‘find -mtime’ command
- Meaning of exit status 1 returned by linux command
- Creating a new directory in C
- Extract file basename without path and extension in bash
- How to change permissions for a folder and its subfolders/files in one step
- mv: cannot stat error : No such file or directory error
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- Pseudo-terminal will not be allocated because stdin is not a terminal
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- TCP congestion control version: HTCP module vs highspeed module in linux kernel
- How to use regex with find command?
- What is the difference between /etc/rc.local and ~/.bashrc?
- Snort Message – WARNING: No preprocessors configured for policy 0
- Compile the Fortran program in Windows using gfortran
- How can I set the ‘backend’ in matplotlib in Python?
- Yum fails with – There are no enabled repos.
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel
- configure: error: cannot run C compiled programs
- What does set -e mean in a bash script?
- How to make rpm auto install dependencies
- How do I install chkconfig on Ubuntu?
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Apache server keeps crashing, “caught SIGTERM, shutting down”
- List all mounts in Linux
- How to use sed to extract substring
- Wait for user input in C?
- Difference between exec, execvp, execl, execv?
- tar: Error is not recoverable: exiting now
- cd into directory without having permission
- python-dev installation error: ImportError: No module named apt_pkg
- How to enable Bash in Windows 10 developer preview?
- WordPress sites being filled with random PHP files
- how to properly mount external server directory for wordpress uploads
- Is it a good idea to edit WordPress within Eclipse? [closed]
- Can scp copy directories recursively?
- What are the functional differences between .profile .bash_profile and .bashrc
- Check if port is open or closed on a Linux server?
- Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?
- Linux command to inspect TXT records of a domain [closed]
- When does `cron.daily` run?
- How to run a command multiple times, using bash shell?
- How to reconnect to a disconnected ssh session
- What does a + mean at the end of the permissions from ls -l?
- Should I quit using Ifconfig?
- SSL Certificate Location on UNIX/Linux
- What is “-bash: !”: event not found”
- What version of RHEL am I using?
- Keeping a linux process running after I logout
- Force dig to resolve without using cache
- How do you make it obvious you are on a production system?
- How can I verify if TLS 1.2 is supported on a remote web server from the RHEL/CentOS shell?
- How to forcibly close a socket in TIME_WAIT?
- How to check if an RSA public / private key pair match
- Mount CIFS Host is down
- Colors in bash after piping through less?
- List of files installed from apt package
- How to copy file preserving directory path in Linux?
- Postfix – how to retry delivery of mail in queue?
- Allow SFTP but disallow SSH?
- Is it possible to alias a hostname in Linux?
- How do I list loaded Linux module parameter values?
- Does getting disconnected from an SSH session kill your programs?
- Tips for Securing a LAMP Server
- What Linux distribution is the Amazon Linux AMI based on?
- What is this IP address: 169.254.169.254?
- How can I export the privileges from MySQL and then import to a new server?
- Is there a directory equivalent of /dev/null in Linux?
- Can I send some text to the STDIN of an active process running in a screen session?
- How can I get processor/RAM/disk specs from the Linux command Line? [duplicate]
- Should I install Linux applications in /var or /opt?
- Is there a way to see the execution tree of systemd?
- How to determine the hostname from an IP address in a Windows network?
- create home directories after create users
- How do I redirect subdomains to a different port on the same server?
- Running Cron every 2 hours [duplicate]
- How to check the physical status of an ethernet port in Linux?
- What does “debconf: delaying package configuration, since apt-utils is not installed” mean?
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?