Join to Get Free Linux Server Hacks & cPanel Tips

Linux error: bash: rsync: command not found

Linux error: bash: rsync: command not found
5 (100%) 3 votes

Today I came across a weird problem that I’ve never seen before. While trying to migrate information from one server to another using rsync I get this error:

bash: rsync: command not found

This was the full output:

[]rsync -avpr -e 'ssh -p 22' root@* /home/company/public_html/
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: remote command not found (code 127) at io.c(600) [receiver=3.0.6]

The problem was on the remote host, who didn’t had rsync installed.

How can I fix bash: rsync: command not found error?

Install rsync on the remote host to fix this issue.

On Ubuntu/Debian operating systems:

apt-get install rsync

On CentOS/RHEL operating systems:

yum install rsync

Output example:

[ ~]# yum install rsync
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Excluding Packages in global exclude list
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rsync.i386 0:3.0.6-6.el5_11 set to be updated
--> Finished Dependency Resolution

rsync i386 3.0.6-6.el5_11 updates 338 k

Total download size: 338 k
Is this ok [y/N]: y
Downloading Packages:
rsync-3.0.6-6.el5_11.i386.rpm | 338 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : rsync 1/1

rsync.i386 0:3.0.6-6.el5_11


Then run rsync again in your new server to transfer the files, it should work without issues.

[]rsync -avpr -e 'ssh -p 22' root@* /home/company/public_html/
receiving incremental file list

That’s all, rsync is working again and your bash: rsync: command not found should be gone.

Further reading: