Утилиты diff и patch
Сравнение каталогов
$ diff /usr/share /usr/local/share
Сравнение двоичных файлов
$ diff /usr/bin/test /usr/bin/[
или
$ diff /bin/test /bin/[
$ ls -i /usr/bin/test /usr/bin/[
или
$ ls -i /bin/test /bin/[
Сравнение текстовых файлов
$ cat hello.c
#include <stdio.h>
main () {
printf("Hello World\n");
}
$ cp hello.c hello.c.old
$ cat hello.c
#include <stdio.h>
main () {
printf("Hello World Again\n");
}
$ diff hello.c.old hello.c
3c3
< printf("Hello World\n");
---
> printf("Hello World Again\n");
diff -e hello.c.old hello.c
3c
printf("Hello World Again\n");
.
$ diff hello.c.old hello.c > hello.patch
$ mv hello.c.old hello.c
$ patch hello.c hello.patch
$ cat hello.c
#include <stdio.h>
main () {
printf("Hello World Again\n");
}