linux tar 파일 압축 및 해제

2022. 7. 20. 17:20Linux

// 현재 디렉토리에 압축 (c)
tar cvfz 압축후이름.tar.gz 압축할폴더
tar cvfz node_modules.tar.gz ./node_modules

// 현재 디렉토리에 해제 (x)
tar zxvf 압축풀파일.tar.gz 
tar zxvf node_modules.tar.gz

.tar는 묶음

.gz는 압축

 

FileZilla를 통해 tar.gz압축파일을 보낸 뒤 리눅스로 설치

Putty 혹은 MobaXterm을 사용

 

tar : puts multiple files into a single (tar) file.

-> 많은 파일들을 하나로 묶어주는 데 사용

.gz : compresses one file (only).

-> 하나의 용량이 큰 파일을 압축

>> 그래서 tar.gz는 하나로 묶은 뒤 압축

 

해당 폴더 내 진입 후 명령어 사용하여 압축풀기 및 설치 진행

 

// 압축풀기

z : means (un)z̲ip.

-> 압축파일

x : means ex̲tract files from the archive.

-> 압축해제

v : means print the filenames v̲erbosely.

-> 파일명 상세하게 출력

f : means the following argument is a f̱ilename.

-> 파일명 지정

-C : 경로 설정

>> tar -zxvf 파일명 -C 경로

 

 

 

// 압축하기

z : means (un)z̲ip.

-> 압축파일

c : means create a new archive.

-> 해당 파일들을 하나의 파일로 압축

v : means print the filenames v̲erbosely.

-> 파일명 상세하게 출력

f : means the following argument is a f̱ilename.

-> 파일명 지정

>> tar -zcvf 생성할파일명 합칠파일들(*.py처럼 * 사용가능)

 

 

앞에 시작하는 명령어에 따라  옵션이 나뉜다

728x90