728x90

압축하기 : compress
- 파일을 압축
- 가장 오래된 압축 유틸리티
- 형식 : compress [옵션] 파일명
- 옵션
- -f : 강제 압축
- -c : 압축 결과를 화면에 출력 (.Z 파일은 생성이 안 됨)
- -V : 압축 정보를 화면에 출력
- 사용 예 : compress test1.txt
$ compress test1.txt
$ ls test1.*
test1.txt.Z
$
- 사용 예 : compress –v test2.txt test3.txt
$ compress –v test2.txt test3.txt
test2.txt: -- replaced with test2.txt.Z Compression: 15.83%
test3.txt: -- replaced with test3.txt.Z Compression: 15.83%
$ ls
test1.txt.Z test2.txt.Z test3.txt.Z
$
- 옵션 없이 사용하면, 정상 압축될 때는 아무 메시지 출력하지 않고, 오류가 있을 때만 오류 메시지 출력
- 여러 파일 압축도 가능
$ compress –v *.txt
- 파일 크기가 작으면 압축하지 않음
- -f 옵션은 강제 압축
- 압축률이 -(마이너스)이면 압축된 결과의 파일이 더 커졌음을 나타냄
$ cat > a.txt
Hello~!
^D
$ ls –l a.*
-rw-r--r-- 1 ksshin ksshin 8 7월 4 08:40 a.txt
$ compress –fv a.txt
a.txt: -- replaced with a.txt.Z Compression: -50.00%
$ ls –l a.*
-rw-r--r-- 1 ksshin ksshin 12 7월 4 08:40 a.txt.Z
$
파일 내용 보기 : zcat
- 압축을 풀지 않고도 압축된 파일의 내용을 볼 수 있음
- 형식 : zcat 파일명
- 사용 예
- zcat test1.txt.Z
- zcat test1.txt
$ zcat a.txt.Z
Hello~!
$
압축 풀기 : uncompress
- compress로 압축된 파일의 압축을 풀어줌
- 형식 : uncompress [옵션] 파일명
- 옵션
- -c : 복원 결과를 화면에 출력
- 사용 예 : uncompress test1.txt.Z, uncompress test1.txt
- 복원할 파일명을 지정하지 않으면 표준 입력을 압축 파일로 간주
$ ls
a.txt.Z test1.txt.Z test2.txt.Z test3.txt.Z
$ uncompress *.Z
$ ls *.txt
a.txt test1.txt test2.txt test3.txt
$
728x90
'프로그래밍 > Unix' 카테고리의 다른 글
호스트와 사용자 정보( hostname, nslookup, ping, finger ) (0) | 2020.04.15 |
---|---|
[유닉스] 파일 아카이브 - .gz 파일, .zip 파일, .bz2 파일 (0) | 2020.04.09 |
[유닉스] 파일 아카이브 - tar 파일, .Z 파일 (0) | 2020.04.09 |
[유닉스] 파일 시스템 마운트 와 복구 (0) | 2020.04.09 |
[유닉스] 디스크 사용 정보, df 명령어, du 명령어 (0) | 2020.04.09 |