User Tools

Site Tools


утилиты_diff_и_patch

Утилиты 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");
}
утилиты_diff_и_patch.txt · Last modified: 2016/04/07 09:25 by val