리눅스 패치 명령


  번역 결과:

patch

English [pætʃ] US [pætʃ]

n. 패치, 패치; 작은 조각

vt. 수리, 일시적으로 수리; .); 뷰티 스팟 장식(얼굴) 사용

vi. patch

3인칭 단수: 패치 복수: 패치 현재 분사: 패치 과거 시제: 패치: 패치

리눅스 패치 명령통사론

기능: patch 명령은 파일을 패치하는 데 사용됩니다. 이는 Linux 시스템의 핵심 업그레이드 방법 중 하나입니다.

구문: ​​patch [-bceEflnNRstTuvZ][-B <백업 접두사 문자열>][-d <작업 디렉터리>][-D <식별 기호>][-F <열 수 모니터링>] [-g <제어 값>][-i <패치 파일>][-o <출력 파일>][-p <스트리핑 수준>][-r <거부 파일>][-V <; 백업 방법>][-Y <백업 접두사 문자열>][-z <백업 접미사 문자열>][--backup-if -mismatch ][--binary][--help][--nobackup-if- 불일치][--verbose][원본 파일<패치 파일>] 또는 경로 [-p <제거된 레이어>] < [ 패치 파일]

리눅스 패치 명령예

패치 명령을 사용하여 "testfile1" 파일을 업그레이드합니다. 업그레이드 패치 파일은 "testfile.patch"입니다. 다음 명령을 입력하세요.

$ patch -p0 testfile1 testfile.patch    #使用补丁程序升级文件

이 명령을 사용하기 전에 "cat" 명령을 사용하여 내용을 볼 수 있습니다. "테스트파일1". 수정 및 업그레이드가 필요한 파일과 원본 파일 사이에 포인터

令"diff"比较可以生成补丁文件。具体操作如下所示:
$ cat testfile1                 #查看testfile1的内容  
Hello,This is the firstfile!  
$ cat testfile2                 #查看testfile2的内容  
Hello,Thisisthesecondfile!  
$ diff testfile1 testfile2          #比较两个文件  
1c1  
<Hello,Thisisthefirstfile!  
---  
>Hello,Thisisthesecondfile!  #将比较结果保存到tetsfile.patch文件  
$ diff testfile1 testfile2>testfile.patch     
$ cat testfile.patch                #查看补丁包的内容  
1c1  
<Hello,Thisisthefirstfile!  
---
>Hello,Thisisthesecondfile!  #使用补丁包升级testfile1文件  
$ patch -p0 testfile1 testfile.patch      
patching file testfile1  
$cat testfile1                  #再次查看testfile1的内容  
#testfile1文件被修改为与testfile2一样的内容  
Hello,This is the secondfile!
를 사용하세요.

인기 추천

비디오

Q&A