Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-27-2016, 03:05 AM   #1
LQ Newbie
Registered: Oct 2016
Posts: 1

Rep: Reputation: Disabled
diff -r on remote server

Directory A is on local machine and directory B on a remote server(password not required on ssh).
I want to check diff between these two directories.
Currently using command:

staging_path (path of directory on local machine)
production_path (path of directory on remote server)
user_at_host (ssh

DiffCommand = "diff -r "+ staging_path + " | " + user_at_host + " " + production_path + " >>new_purge.txt"

I am getting an error while using this command

diff: missing operand after `/files/QAEngines/working/1016/PRODUCTION/courses/electrical-engineering-and-computer-science/6-041sc-probabilistic-systems-analysis-and-applied-probability-fall-2013'
diff: Try `diff --help' for more information.
bash: /var/lib/tomcat5/webapps/courses/electrical-engineering-and-computer-science/6-041sc-probabilistic-systems-analysis-and-applied-probability-fall-2013: is a directory
Old 10-27-2016, 05:02 AM   #2
Senior Member
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 2,627
Blog Entries: 3

Rep: Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157
What information are you trying to collect in the variable $DiffCommand there?

The easy way I can think of could be to mount the remote directory using "sshfs" and then running "diff -r" as normal over the local and the mounted remote directories.

Otherwise, the harder way is to do it in two parts. (Just a guess)

Since you can still use "diff" to compare individual files over "ssh"

diff /path/to/a/file <(ssh 'cat /path/to/another/file')
and since "rsync" can list differing file names using --dry-run

rsync -av --dry-run -e 'ssh -i ~/.ssh/some_key_rsa' /local/path/
you could combine the two. Loop through the output of "rsync" and run "diff" against those files found.

But I'd try the "sshfs" method first, I may have left something out of the "rsync" guess.

Last edited by Turbocapitalist; 10-27-2016 at 05:07 AM. Reason: removed extra single quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo connect to a remote server and execute scripts in remote server masubram Linux - Newbie 6 07-31-2016 10:35 AM
Installing a linux-distro remote desktop on an already remote debian server... errr? Sabinou Linux - Newbie 2 04-26-2012 06:29 PM
how to do remote diff? jimmyjiang Red Hat 3 04-20-2007 08:58 PM
Diff of Enterprise server and Advance server roy3378 Linux - Newbie 2 08-02-2005 08:47 PM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 07:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration