Linux

[ Linux ] Tar 사용법

Jerry_JH 2024. 3. 11. 23:48
728x90
 

리눅스에서 파일 압축하는 방법 중 tar 를 이용하여 압축하는 방법

 

[ 형식 ]

tar [option] [file]

 

[ Option ] - 주로 사용하는 것만  

1. -f, --file=ARCHIVE       use archive file or device ARCHIVE

2. -c, --create                   create a new archive

3. -x, --extract, --get        extract files from an archive

4. -v, --verbose                verbosely list files processed

5. -z, --gzip, --gunzip, --ungzip   filter the archive through gzip

6. -w, --interactive, --confirmation   ask for confirmation for every action

7. -k, --keep-old-files       don't replace existing files when extracting

8. -U, --unlink-first         remove each file prior to extracting over it

 

* tar --help 치면 더 다양한 옵션을 볼 수 있음.

 

 

[ 사용했었던 명령어 ]

 

1. 압축할때

tar -cvf /data_tmp/5.tar /data/server/projects/5 

 

2. 압축풀때

tar -xvf /job/server/projects/5.tar

 

 

 

728x90