• tar


    rm -rf *  # delete the content of current directory.

    Creating the Archive

    To place the files 'blues','folk' and 'jazz' into an archive named 'collection.tar',use the following command:

    Note:

      collection.tar is archive,and 'blues','folk','jazz' are archive members.

    tar --create --file=collection.tar blues folk jazz

    Or

    tar -c -f collection.tar blues folk jazz

    Or

    tar -cf collection.tar blues folk jazz
    • Always place option as the first argument.
    • Note that the sequence '--file=collection.tar' is considered to be one argument.

    You could issue the following command,but it's hard to understand:

    tar --create folk blues --file=collection.tar jazz

    About --verbose option

    tar -cf collection.tar blues folk jazz

    No hints.

    tar -cvf collection.tar blues folk jazz
    blues
    folk
    jazz
    tar -cvvf collection.tar blues folk jazz
    -rw-r--r-- dwl/dwl           0 2018-09-14 11:16 blues
    -rw-r--r-- dwl/dwl           0 2018-09-14 11:16 folk
    -rw-r--r-- dwl/dwl           0 2018-09-14 11:16 jazz

    IMPORTANT:

    tar -cfv collection.tar blues folk jazz

    will create a archive named v, which containing archive member collection.tar (if do not exist,tar will complain,and create v archive without collection.tar),blues,folk,jazz. Because v is closest to the -f option.As you see,it's very risky when using short options.

    Caution: Do not attempt to use ‘--create’ (‘-c’) to add files to an existing archive; it will delete the archive and write a new one. Use ‘--append’ (‘-r’) instead.

    Archiving Directories

    treat directories just like file.

    tar -cvf music.tar practice
    tar -cvf music.tar ../practice  # do not need leaving current director

     

     

    Extracting Specific Files

    tar -xvvf collection.tar jazz

    produce:

    -rw-r--r-- dwl/dwl           0 2018-09-14 11:16 jazz

    also you can use:

    tar -xvf collection.tar jazz

    or

    tar -xf collection.tar jazz
  • 相关阅读:
    vmware中的虚拟系统和真实系统同时上网
    code first实现自关联(树结构数据)
    td无内容如何显示边框
    vs新建模板
    为ashx文件启用session管理
    有效防止SQL注入漏洞
    用DIV建左右自动伸缩型布局
    身份证验证算法
    CSS布局需注意的问题
    使用sharppcap抓数据包
  • 原文地址:https://www.cnblogs.com/luwudang/p/9646118.html
Copyright © 2020-2023  润新知