[教学]tar 解压缩部份目录

Home Home
引用 | 编辑 aa
2003-08-19 11:13
楼主
推文 x0
由于我备份的压缩档太大(3.6G),若全部解压缩要 9G 的空间,而我只要救
其中的200多k的资料,全解要很久又很占空间,用 man tar 也找不到指令
的用法,后来问了一下朋友,才查到的

复制程式
Listing the Contents of a Stored Directory 
(This message will disappear, once this node revised.) 
@quote-arg {i changed the order of these nodes around and haven't had a chance to play around with this node's example, yet. i have to play with it and see what it actually does for my own satisfaction, even if what it says *is* correct..} 

To get information about the contents of an archived directory, use the directory name as a file name argument in conjunction with --list (-t). To find out file attributes, include the --verbose (-v) option. 

For example, to find out about files in the directory `practice', in the archive file `music.tar', type: 

  $ tar --list --verbose --file=music.tar practice


tar responds: 

  drwxrwxrwx myself user 0 1990-05-31 21:49 practice/
-rw-rw-rw- myself user 42 1990-05-21 13:29 practice/blues
-rw-rw-rw- myself user 62 1990-05-23 10:55 practice/folk
-rw-rw-rw- myself user 40 1990-05-21 13:30 practice/jazz
-rw-rw-rw- myself user 10240 1990-05-31 21:49 practice/collection.tar


When you use a directory name as a file name argument, tar acts on all the files (including sub-directories) in that directory. 

例如我要解 home.tgz 中的 ncc 目录
复制程式
tar zxvf home.tgz home/ncc


献花 x0