|
嚜
Linux 蝔桀蝮株閫憯蝮格隞:
: L+ D' Y* E W8 K.tar* p: m4 c, h+ V5 D7 P
.gz
- }3 I5 k a! o1 M- J8 e6 d1 Y- U" H.tar.gz ) J8 W! w. L3 [0 t% ]" \/ f; Q
湔配ar.gz憯蝮格扳銝瑼獢桅批嗾瑼獢: 靘憒% `& u/ v I' P5 v* a
: https://askubuntu.com/questions/ ... pdate-a-tar-gz-file2 l5 c2 y" Q- {; z T. X
1.)撠.tar.gz閫憯.tar: |' B, e/ r. V6 x+ [
gunzip filename.tar.gz1 a7 H/ S$ C. x7 c I; E" z3 @
2.)湔.tar
$ ?* T. o/ B% s9 b& } b# B! G+ w tar -uvf filename.tar new_file 8 `7 x( @+ _$ X1 `$ m# m7 }
tar -uvf filename.tar subdir/*
! O6 U& ` D& G$ g+ [" f5 q 3.)憯蝮桀歇湔唳.tar
* V0 Z5 z: Z- N/ _. Z- F, t gzip filename.tar5 Q6 V0 x3 _. J J. m( e o; F$ t7 X" v1 S
4 y+ U& J# [; D9 L& n! P4 h3 y
支喳蝮桃桅瑼獢: 靘憒& g( Y0 K$ J e# @
閬隞賜桅 aaa& f) D7 j. {8 a$ @2 D* V) U6 _
銝唾隞賜 aaa 鋆⊿Y bbb 摮桅 ( z9 N" g: t' F, j
tar zpcvf aaa_backup.tar.gz --exclude=./aaa/bbb ./aaa
2 o7 e2 N7 A% Q0 w! z. R
! j% s6 M( G9 R9 ^; }憯蝮桐怨楝敺鞈閮(蝯撠頝臬): 靘憒# h5 s/ g) v. `" p1 n0 A9 ^
閬憯蝮 /home/user1/tmp/* ,( a.txt ,b.txt)銝蝞∠桀撌乩桅典,賢臭誑餅桅鞈閮,靘憒 桀撌乩桅 /- i6 `" a; {6 x2 r& u0 w1 S
# tar -zcvf tmp.tar.gz -C /home/user1 tmp (tmp銝蝛箸)銝靽" /home/user1"頝臬
/ p, l& q% P$ Y8 g # tar -ztvf tmp.tar.gz ! U$ q; ?- K& a1 h
drwxrwxr-x user1/user1 0 2018-04-07 12:10 tmp/
P, `, S2 L |. D; D% g -rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/a.txt T- B8 ~' f; N; B {) @9 t
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/b.txt c5 v7 \6 Q% a; y7 ^7 { ^
# tar -zcvf tmp.tar.gz -C /home/user1/tmp . (tmp敺銝蝛箸澆銝暺)銝靽" /home/user1/tmp"頝臬$ i' J0 ^9 Q# \- ?' r+ r
# tar -ztvf tmp.tar.gz 3 z8 O" o% d$ e. T) z
drwxrwxr-x user1/user1 0 2018-04-07 12:10 ./. A% Y! h( X4 D/ a
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./a.txt3 X5 v4 |( c) ]
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./b.txt% e: z2 e) p) F2 {9 n
桀撌乩桅 /home/user1
) k/ a" d" C- A3 F" Y, s, q! h # tar -zcvf tmp.tar.gz tmp- J6 K$ l' g0 B9 H3 Z2 l
# tar -ztvf tmp.tar.gz, T$ g6 G. H+ R3 Y4 Z3 [$ k
drwxrwxr-x user1/user1 0 2018-04-07 12:10 tmp/
7 }, \* h! m. I -rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/a.txt
6 ~( x" g3 K# b2 [) k7 e5 E -rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/b.txt
* M% ]! z% {$ x7 H1 ? # tar -zcvf tmp.tar.gz -C tmp . (銝暺)銝靽" tmp"頝臬% S) e+ c9 J8 z
# tar -ztvf tmp.tar.gz6 Q. f, ]; n% S; u( Y9 E: ]
drwxrwxr-x user1/user1 0 2018-04-07 12:10 ./
_ B8 k! V6 G- s9 D8 O7 i -rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./a.txt! c: G. e" Q* v8 \/ d
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./b.txt
- F) U. H# ]: R8 J4 t! m7 F. H: O7 l
閫憯蝮桀唳摰桅 靘憒 閫憯/home/user1/tmp.tar.gz /home/user1/tmp 撌乩桅/home/user15 d, H- D5 \. h6 a- ]; n6 }5 e2 K
# tar -C tmp -zxvf tmp.tar.gz 臭誑雿輻函詨頝臬, -C(憭批神)銝摰閬亙系ar敺,嗡雿蝵桅賭銵
~7 `/ u% A; Z* b # tar -C /home/user1/tmp -zxvf tmp.tar.gz 臭誑雿輻函撠頝臬
/ _7 i* E( C( ?7 `5 p6 C 憒撌乩桅/home 隞亙雿蝵桀停閬雿輻函撠頝臬& k4 ^0 O) d9 M' }5 B) z" Y' m x
.bz( X6 y% l6 a! _9 D/ Z
.tar.bz
, o8 s, C- r. T$ X3 N.bz29 c9 D C6 I) c1 C; ~
.tar.bz2$ j! H4 Z& A. A1 Z. [
.xz
4 d4 M5 O u7 p0 u- m2 d5 Q% J) u) v.tar.xz% G8 A/ a6 S. f9 `. t' o+ |
.Z+ ~& z9 d$ r- `& \' f# {. E, @
.tar.Z& `* X" Z* [0 N6 J: L( x
.tgz
2 t. t! A9 {! c.tar.tgz
# p, H7 T `+ ]. f.7z
- t- [ }' C+ T.zip9 s+ E# ?- k" l0 q
.rar, W: w+ i9 s. ~* c9 [ M
.lha
: D: y" l8 z9 C. c$ { h
- B- a, `5 j/ ^, Y3 P6 h- i( Dsplit : 憭扳脫撠瑼靘憒:% A; ^' j" v0 F. `9 ?2 a# `
銝500MB瑼獢(file.tar.gz),脫瘥瑼50M撠瑼獢臭誑其誑銝隞 1 \+ s$ l3 g+ S- {
split -b 50m file.tar.gz (m 臭誑寞G(giga))# W4 k, H5 \5 g; M5 b& j
亥雿 臭誑牢at 隞斗鈭撠瑼獢雿菜銝憭扳獢 靘憒:2 {. O# l( E: C6 [# k/ J! R
cat xaa xab xac xad xae xaf > file.tar.gz
1 V. A! D/ Z C$ u* l8 @3 \6 F6 N% j% w
; l# `( I% E9 y/ s9 A# L+ S : + r) g2 J! y/ b& ~7 }% q+ P
http://note.drx.tw/2008/04/command.html
, Z# d j% e; J8 Z7 B7 I- h, l$ h' n u# _; g: Z4 @, ?+ H1 d
|
|
|