Like many things on this blog, I don’t use this enough to remember the full command when I need it. Like always, don’t just copy and paste this information. Use the man pages to verify what it is that you need to do.
rsync -a -v --delete --update --stats /path/to/local/data/ user@<server-name>:/path/to/folder/
This version of the command essentially maintains ownership and permissions while allowing for file changes, including file deletions, to be copied from the local server to another server. It mirrors the data on the local server to a second server. It also provides a listing of statistics when the command has completed.
A similar command using robocopy on MS systems was posted at an earlier date and can be found here:
Linux distributions sometimes configure “ll” (lowercase L’s) as an alias to “ls -l”. Debian based OS’s typically do this from the users ~/.bashrc file. This is not the case with Red Hat/CentOS based OS’s. I couldn’t remember where CentOS set the alias and I needed to locate it. As a non-root user, this proved to be a little more challenging than I first expected. Yes, I could look it up on the web but I decided to make an exercise out of it and it was more challenging than it would first seem.
grep -riE "alias ?ll" /etc/ 2> /dev/null
I’m sure there are other ways to it but this worked. In short. I knew I needed to search for “ll” in /etc, but “ll” is also common in many words. Also, I’m running as a normal user so I wanted to avoid “Permission Denied” and other errors that cluttered the search.
It’s been a while since I last did this but you never know when you might need it. When you see a “dd” command, you better make sure you know what you are doing. In other words, don’t type this just as you see it!