Compare Files Remotely with Diff
For example, compare ~/.vimrc at different hosts:
ssh bvt@10.0.2.74 "cat /home/bvt/.vimrc" | diff -y --suppress-common-lines - .vimrc
where -y is abbr. of "--side-by-side".
Compare Files in Two Directories
Usually we use the following command to compare source files in two directories:
Find out which files are different
┌─[lichao@lichao480] - [~/docs/erlang/processquest-1.0.0/apps] └─[$] diff -rq sockserv-1.0.0/src sockserv-1.0.1/src Files sockserv-1.0.0/src/sockserv_serv.erl and sockserv-1.0.1/src/sockserv_serv.erl differ
then use vimdiff to show detailed differences between these files.
-r means "recursively", -q means only report different files.
Print out differences of files directly
┌─[lichao@lichao480] - [~/docs/erlang/processquest-1.0.0/apps] - [1672] └─[$] diff -y --suppress-common-lines sockserv-1.0.0/src sockserv-1.0.1/src diff -y --suppress-common-lines sockserv-1.0.0/src/sockserv_serv.erl sockserv-1.0.1/src/sockserv_serv.erl > gen_tcp:close(S#state.socket), terminate(normal, #state{socket=S}) -> | terminate(normal, _State) -> gen_tcp:close(S); | ok;