"리눅스 cmp"의 두 판 사이의 차이

잔글 (Jmnote 사용자가 Cmp 문서를 리눅스 cmp 문서로 옮겼습니다)
 
(사용자 2명의 중간 판 8개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{다른뜻|클라우드 관리 플랫폼 CMP}}
{{소문자}}
{{소문자}}
==개요==
==개요==
7번째 줄: 8번째 줄:
*다른 점이 없으면 아무 메시지 없음
*다른 점이 없으면 아무 메시지 없음


<source lang='dos'>
==실습 1: 기본실행==
[root@jmnote ~]# cat 1.txt
<source lang='console'>
[root@zetawiki ~]# echo hello > 1.txt
[root@zetawiki ~]# echo hello world > 2.txt
[root@zetawiki ~]# cat 1.txt
hello
hello
world
[root@zetawiki ~]# cat 2.txt
[root@jmnote ~]# cat 2.txt
hello world
Hello
[root@zetawiki ~]# cmp 1.txt 1.txt
World!
[root@zetawiki ~]# cmp 1.txt 2.txt
</source>
<source lang='dos'>
[root@jmnote ~]# cmp 1.txt 1.txt
[root@jmnote ~]# cmp 1.txt 2.txt
1.txt 2.txt differ: byte 1, line 1
1.txt 2.txt differ: byte 1, line 1
</source>
</source>


==실습 2: -s 옵션==
*-s 옵션(--silent)을 주면 아무 것도 출력되지 않음. [[종료 상태값]]만 남음
*같으면 0, 다르면 1
<source lang='console'>
[root@zetawiki ~]# cmp -s 1.txt 1.txt
[root@zetawiki ~]# echo $?
0
[root@zetawiki ~]# cmp -s 1.txt 2.txt
[root@zetawiki ~]# echo $?
1
</source>
==같이 보기==
==같이 보기==
*[[diff]]
*[[리눅스 diff]]


[[분류: /usr/bin]]
[[분류: /usr/bin]]

2018년 9월 28일 (금) 00:09 기준 최신판

  다른 뜻에 대해서는 클라우드 관리 플랫폼 CMP 문서를 참조하십시오.

1 개요[ | ]

cmp
/usr/bin/cmp
  • 파일 비교 리눅스 명령어
  • 한 행씩 비교하여 다른 점이 있으면 다르다는 메시지와 함께 종료
  • 다른 점이 없으면 아무 메시지 없음

2 실습 1: 기본실행[ | ]

[root@zetawiki ~]# echo hello > 1.txt
[root@zetawiki ~]# echo hello world > 2.txt
[root@zetawiki ~]# cat 1.txt
hello
[root@zetawiki ~]# cat 2.txt
hello world
[root@zetawiki ~]# cmp 1.txt 1.txt
[root@zetawiki ~]# cmp 1.txt 2.txt
1.txt 2.txt differ: byte 1, line 1

3 실습 2: -s 옵션[ | ]

  • -s 옵션(--silent)을 주면 아무 것도 출력되지 않음. 종료 상태값만 남음
  • 같으면 0, 다르면 1
[root@zetawiki ~]# cmp -s 1.txt 1.txt
[root@zetawiki ~]# echo $?
0
[root@zetawiki ~]# cmp -s 1.txt 2.txt
[root@zetawiki ~]# echo $?
1

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}