카테고리 없음
[bash] tar 사용하기
냐옴
2024. 4. 11. 09:51
옵션
-c, --create create a new archive
-r, --append append files to the end of an archive
-t, --list list the contents of an archive
-x, --extract, --get extract files from an archive
-C, --directory=DIR change to directory DIR
-v, --verbose verbosely list files processed
-f, --file=ARCHIVE use archive file or device ARCHIVE
-T, --files-from=FILE get names to extract or create from FILE
파일 압축하기
## html 디렉토리를 tar 로 압축하기
tar cvf aa.tar html/
## 파일 여러 개를 tar 로 압축하기
tar cvf aa.tar favicon.ico favicon.png
압축을 풀지 않고 파일 목록 확인하기
## tar 파일에 있는 파일 목록 확인하기
tar tvf aa.tar
기존 tar 파일에 파일 추가하기
## 기존 tar 파일에 파일 추가하기
tar rvf aa.tar favicon.png
tar 파일 풀기
## tar 파일 전체 풀기
tar xvf aa.tar
tar 파일에서 특정 파일만 추출하기
## tar 파일에서 특정 파일만 추출하기
tar xvf aa.tar favicon.png
텍스트 파일에 있는 목록만 압축하기
tar cvf aa.tar -T file.txt