
TAR/TAR.GZ/TAR.BZ2에서 아카이브 파일 내용을 나열하는 방법
2022-10-18 last update
6 minutes reading tar아카이브 파일로 작업하는 동안 때때로 extract an archive file 대신 아카이브 파일 내용을 나열해야 합니다. 이것을 사용하여 아카이브 파일에서 사용 가능한 파일을 볼 수 있습니다. 18 Linux tar command examples
아카이브 파일 내용 나열(빠른 명령)
으로 다른 튜토리얼을 읽어보십시오. -t 스위치는 추출이 없는 tarball 파일의 목록 내용에 사용됩니다. 다음은 .tar, .tar.gz, .tar.bz2 및 .tar.xz 파일 내용을 나열하는 데 사용되는 빠른 명령입니다.tar -tvf archive.tar tar -ztvf archive.tar.gz tar -jtvf archive.tar.bz2 tar -Jtvf archive.tar.xz
.tar 파일 내용 나열
-t 스위치를 tar 명령과 함께 사용하여 실제로 압축을 풀지 않고 archive.tar 파일의 내용을 나열합니다. 출력이 ls -l 명령의 결과와 매우 유사함을 알 수 있습니다.[샘플 출력]tar -tvf archive.tar
drwxr-xr-x root/root 0 2018-01-12 11:11 backup/ drwxr-xr-x root/root 0 2018-01-12 11:09 backup/data/ -rw-r----- root/root 1058 2018-01-12 11:09 backup/data/config.ini -rw-r--r-- root/root 29 2018-01-12 11:11 backup/.htaccess -rw-r----- root/root 442 2018-01-12 11:08 backup/access.log -rw-r--r-- root/root 7 2018-01-12 11:09 backup/index.html lrwxrwxrwx root/root 0 2018-01-12 11:11 backup/config -> data/config.ini
.tar.gz 파일 내용 나열
-z 스위치를 사용하여 .tar.gz 파일을 처리하고 -t를 사용하여 아카이브 파일 내용을 나열합니다. 파일을 추출하지 않고 archive.tar.gz 파일 내용을 나열하려면 아래 예를 참조하십시오.[샘플 출력]tar -ztvf archive.tar.gz
drwxr-xr-x root/root 0 2018-01-12 11:11 html/ drwxr-xr-x root/root 0 2018-01-12 11:09 html/config/ -rw-r----- root/root 1058 2018-01-12 11:09 html/config/config.ini -rw-r--r-- root/root 29 2018-01-12 11:11 html/.htaccess -rw-r----- root/root 442488 2018-01-12 11:08 html/access.log -rw-r----- root/root 263636 2018-01-12 11:08 html/error.log -rw-r--r-- root/root 17 2018-01-12 11:09 html/index.html lrwxrwxrwx root/root 0 2018-01-12 11:11 html/config.ini -> config/config.ini
.tar.bz2 파일 내용 나열
-j 스위치를 사용하여 tar.bz2 파일을 처리하고 -t를 사용하여 아카이브 파일 내용을 나열합니다. 파일을 추출하지 않고 archive.tar.bz2 파일 내용을 나열하려면 아래 예를 참조하십시오.[샘플 출력]tar -jtvf archive.tar.bz2
drwxr-xr-x root/root 0 2018-01-12 11:11 www/ drwxr-xr-x root/root 0 2018-01-12 11:09 www/data/ -rw-r----- root/root 1994 2018-01-10 10:19 www/data/config.ini -rw-r--r-- root/root 29 2018-01-12 11:11 www/.htaccess -rw-r----- root/root 33442 2018-01-11 10:08 www/index.php lrwxrwxrwx root/root 0 2018-01-12 11:11 www/config -> data/config.ini
.tar.xz 파일 내용 나열
tar.xz 파일을 처리하는 데 -J(대문자 J) 스위치를 사용하고 아카이브 파일 콘텐츠 목록에 -t를 사용합니다. 파일을 추출하지 않고 archive.tar.xz 파일 내용을 나열하려면 아래 예를 참조하십시오.[샘플 출력]tar -Jtvf archive.tar.xz
drwxr-xr-x root/root 0 2018-01-12 11:11 www/ drwxr-xr-x root/root 0 2018-01-12 11:09 www/data/ -rw-r----- root/root 1994 2018-01-10 10:19 www/data/config.ini -rw-r--r-- root/root 29 2018-01-12 11:11 www/.htaccess -rw-r----- root/root 33442 2018-01-11 10:08 www/index.php lrwxrwxrwx root/root 0 2018-01-12 11:11 www/config -> data/config.ini