|
嚜
Linux 蝔桀蝮株閫憯蝮格隞:7 M% N- ~0 y9 v" I; F, {& ^
.tar! c5 V0 X1 S5 M0 `! ^
.gz5 X5 h8 r" o+ H
.tar.gz
# G- y, A; A4 j' r7 l( l3 U# L湔配ar.gz憯蝮格扳銝瑼獢桅批嗾瑼獢: 靘憒
9 _% S2 A- g5 x+ e: https://askubuntu.com/questions/ ... pdate-a-tar-gz-file" N2 e4 ?8 H5 v/ X& ^* l+ l6 x
1.)撠.tar.gz閫憯.tar) S4 _# a0 [! V0 s; B
gunzip filename.tar.gz
% Z& b3 I# a, Q, _8 \& b 2.)湔.tar k4 y9 _' U: x3 `
tar -uvf filename.tar new_file 8 S+ ^7 u2 V/ ?. Y9 t! x: P# E; ]
tar -uvf filename.tar subdir/*
& m( W% C7 [0 Q 3.)憯蝮桀歇湔唳.tar
" O" p$ j' v, X, C w5 y( X gzip filename.tar
; _6 C) s1 F! H9 Q9 D- ~/ u" V3 n% W7 F
支喳蝮桃桅瑼獢: 靘憒( Y7 @/ w* \$ p- ~ J4 Q- K
閬隞賜桅 aaa
9 ]8 S6 t2 S3 h) V5 J 銝唾隞賜 aaa 鋆⊿Y bbb 摮桅
8 N9 @! J5 `; k tar zpcvf aaa_backup.tar.gz --exclude=./aaa/bbb ./aaa
7 r# a: d4 c9 E9 A; g2 U X1 `2 I8 b/ c+ Y
憯蝮桐怨楝敺鞈閮(蝯撠頝臬): 靘憒! K6 K* N* V8 f% `
閬憯蝮 /home/user1/tmp/* ,( a.txt ,b.txt)銝蝞∠桀撌乩桅典,賢臭誑餅桅鞈閮,靘憒 桀撌乩桅 /9 j9 ]4 C8 Q0 [
# tar -zcvf tmp.tar.gz -C /home/user1 tmp (tmp銝蝛箸)銝靽" /home/user1"頝臬
& ^! F( \/ k. V) w0 o# B # tar -ztvf tmp.tar.gz ( u1 q2 h' R/ C: c# K# ^0 H- @; ?
drwxrwxr-x user1/user1 0 2018-04-07 12:10 tmp/
7 Y1 U1 o, X( t0 @3 R& _. J -rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/a.txt
0 `/ z2 j' V9 l' j -rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/b.txt/ z* B" G. r* D3 { E# w4 @. c
# tar -zcvf tmp.tar.gz -C /home/user1/tmp . (tmp敺銝蝛箸澆銝暺)銝靽" /home/user1/tmp"頝臬* [: m1 y. A; i* V+ j3 |( w
# tar -ztvf tmp.tar.gz . G, s3 U* e0 r4 B: i
drwxrwxr-x user1/user1 0 2018-04-07 12:10 ./
+ ^- d1 Q1 q. w5 @ ~' z -rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./a.txt: T& ?5 Y! e) n% F& _. e8 l
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./b.txt7 ?& i, _% M3 N
桀撌乩桅 /home/user1' B0 P' e# s9 D- b4 H
# tar -zcvf tmp.tar.gz tmp
6 t: N# s; p4 e4 \ # tar -ztvf tmp.tar.gz
3 t8 [( ~+ e: c7 e8 }' X/ ^ drwxrwxr-x user1/user1 0 2018-04-07 12:10 tmp/7 Q( T6 a( G, [7 L
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/a.txt# y1 Z% ~ O& K1 g
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 tmp/b.txt
' A7 W" |0 x9 y _& c # tar -zcvf tmp.tar.gz -C tmp . (銝暺)銝靽" tmp"頝臬% I2 z- e- k, R' M3 W% @ _ D2 t6 @
# tar -ztvf tmp.tar.gz3 r4 e; I1 Q- D+ Y
drwxrwxr-x user1/user1 0 2018-04-07 12:10 ./! Z$ M1 _) t' ^8 S' U4 w
-rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./a.txt
3 G# n2 r! ^6 s2 k2 z -rw-rw-r-- user1/user1 13 2018-04-07 12:10 ./b.txt
9 O$ f7 @, C! f+ W7 A2 T) M& g( y, b1 ?4 u/ Z1 j' p2 M
閫憯蝮桀唳摰桅 靘憒 閫憯/home/user1/tmp.tar.gz /home/user1/tmp 撌乩桅/home/user1
# B- ?+ \, |' [$ j3 @0 X # tar -C tmp -zxvf tmp.tar.gz 臭誑雿輻函詨頝臬, -C(憭批神)銝摰閬亙系ar敺,嗡雿蝵桅賭銵5 t! l; ? }& F. j" g- _6 B
# tar -C /home/user1/tmp -zxvf tmp.tar.gz 臭誑雿輻函撠頝臬+ @* Y+ Q! F$ q8 @+ c
憒撌乩桅/home 隞亙雿蝵桀停閬雿輻函撠頝臬, X0 c6 i$ v' _
.bz
* E A w; ~) o. g7 P( W3 c.tar.bz
6 ?0 E; }! \- [; [.bz2 v7 _ [, h/ _* z& h4 j
.tar.bz2$ c* Q! O8 n U, v1 k& y6 p
.xz/ `1 d# W7 M% I& Y
.tar.xz+ K1 x# c. u1 _) l8 ^4 ~
.Z, l* r( {8 j" k" q4 E0 J
.tar.Z# v p# q T: q( i0 t
.tgz
' h e7 b$ Z) t! l.tar.tgz
8 L3 a* Q, ]% B# S3 J6 t.7z D* {0 M7 }; [% D
.zip
7 ^6 e' E" k$ P; b1 Z.rar. b. |- K1 b' M- V
.lha
7 ~9 w7 w2 L2 f- A* H
. M- C& p1 q8 f' f% M {split : 憭扳脫撠瑼靘憒:
9 a8 @7 x& O3 t0 @0 z銝500MB瑼獢(file.tar.gz),脫瘥瑼50M撠瑼獢臭誑其誑銝隞
" W& z# t2 x j) u( }split -b 50m file.tar.gz (m 臭誑寞G(giga))# A/ F8 }: ]1 R2 {
亥雿 臭誑牢at 隞斗鈭撠瑼獢雿菜銝憭扳獢 靘憒:1 _( y" O Z! M& e4 n
cat xaa xab xac xad xae xaf > file.tar.gz, s2 j5 z/ q1 j" n2 _* }6 M# T3 r
' a9 g9 {8 S7 A& ^0 D
- `2 ^2 ~" M' F' @. @7 C :
, N, i: e+ z; e; S, _ w" E. N7 Ahttp://note.drx.tw/2008/04/command.html
$ _2 W; X0 e- W) z. i" g; L8 C: w6 t5 H% Z
|
|
|