List the contents of a tar or tar.gz file

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

List the contents of a tar or tar.gz file

文章 yehlu »

http://www.cyberciti.biz/faq/list-the-c ... argz-file/

Q. How do I list the contents of a tar or tar.gz file?

A. GNU/tar is an archiving program designed to store and extract files from an archive file known as a tarfile. You can create a tar file or compressed tar file tar. However sometime you need to list the contents of a tar or tar.gz file on screen before extracting the all files.

Task: List the contents of a tar file
Use the following command:
$ tar -tvf file.tar

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

http://stackoverflow.com/questions/2359 ... ompressing

代碼: 選擇全部

tar -tzf file.tar.gz | wc -l
回覆文章

回到「Linux」