• 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
  • 相关阅读:
    派生选择器
    HTML 标签
    $.get()
    CC150
    CC150
    CC150
    CC150
    HashMap和HashTable的区别
    CC150
    quickSort
  • 原文地址:https://www.cnblogs.com/luwudang/p/9646118.html
Copyright © 2020-2023  润新知