OS/리눅스
리눅스 tar/tar.gz/zip 사용법
SSaMKJ
2015. 11. 4. 10:31
서버는 주로 centos 등의 리눅스 서버를 많이 사용하는데, 압축/압축 해제 할 일이 많다 보니 여기에 기록한다.
tar 압축
tar -cvf 파일명.tar 폴더명 ex) tar -cvf hello.tar hello
tar 압축 풀기
tar -xvf 파일명.tar ex) tar -xvf hello.tar
사실 tar는 압축이 아니라 파일을 하나로 모으는 것이다.
이것을 압축하기 위해서는 tar.gz를 사용하면 된다.
tar.gz 압축
tar -zcvf 파일명.tar.gz 폴더명 ex) tar -zcvf hello.tar.gz hello
tar.gz 압축 풀기
tar -zxvf 파일명.tar.gz ex) tar -zxvf hello.tar.gz
윈도우와 주고 받으려면 zip이 편하다.
zip 압축
zip -r 파일명.zip 폴더명 ex) zip -r hello.zip hello
zip 압축 풀기
unzip 파일명.zip ex) unzip hello.zip
zip은 실행권한을 보존하지 않기 때문에 리눅스에서 주로 tar를 사용한다.