본문 바로가기
개발/리눅스

tar gz 리스트 보기

by 로그인시러 2017. 5. 22.




tar -tf filename.tar.gz


or



Syntax

To view a detailed table of contents for archive called my-data.tar.gz, use the following syntax:
tar -ztvf my-data.tar.gz
tar -tvf my-data.tar.gz
tar -tvf my-data.tar.gz 'search-patter'

Examples

Let us see some examples:

Task: List the contents of a tar file

Use the following command:
$ tar -tvf file.tar
Sample outputs:

Task: List the contents of a tar.gz file

Use the following command:
$ tar -ztvf file.tar.gz

Task: List the contents of a tar.bz2 file

Use the following command:
$ tar -jtvf file.tar.bz2

Task: Search for specific files

In this example, look for *.pl (all perl files) inside a detailed table of contents for archive called projects.tar.gz:
$ tar -tvf projects.tar.bz2 '*.pl'
Where,

  • t: List the contents of an archive.
  • v: Verbosely list files processed (display detailed information).
  • z: Filter the archive through gzip so that we can open compressed (decompress) .gz tar file.
  • j: Filter archive through bzip2, use to decompress .bz2 files.
  • f filename: Use archive file called filename.



출처 : https://www.cyberciti.biz/faq/list-the-contents-of-a-tar-or-targz-file/

'개발 > 리눅스' 카테고리의 다른 글

grep 하위디렉토리 파일안 문자열 검색  (0) 2017.08.11
simple grep 사용법  (0) 2017.05.22
centos 7 hostname 변경  (0) 2017.04.13
rpm 정리 [펌]  (0) 2017.03.30
chown  (0) 2017.03.29

댓글