在CentOS中使用rsync命令可以很方便地进行文件同步操作。以下是使用rsync命令进行文件同步的步骤:
sudo yum install rsync
rsync -avzh /path/to/source /path/to/destination
其中,-a参数表示以递归方式同步文件夹,-v参数表示显示详细输出,-z参数表示压缩传输,-h参数表示以可读的方式显示文件大小。/path/to/source为源文件夹的路径,/path/to/destination为目标文件夹的路径。
rsync -avzh username@remote_host:/path/to/source /path/to/destination
其中,username为远程服务器的用户名,remote_host为远程服务器的地址。
通过以上步骤,您就可以在CentOS中使用rsync命令进行文件同步操作了。