Tar Command
Tar ဆိုတာကတော့ Tape Archive ကိုအတိုကောက်ခေါ်ခြင်းပဲဖြစ်ပါသည်။ကျွန်တော်တို့အသုံးပြုနေသည့် Windows မှာလိုပဲ zip,rar တို့ကိုအသုံးပြုပြီးချုံ့ထားသည့် file တွေရဲ့ Format ကိုပြောတာပဲဖြစ်ပါ တယ်။linux မှာဆိုရင်တော့ file/directory တွေကို tar,zip,gzip စသည်တို့ကိုအသုံးပြုပြီးတော့ compress လုပ်ချင်သည့် အခါမျိုးမှာအသုံးပြုပါတယ်။အရင်ဆုံးအနေနဲ့ Tar Command ရဲ့အသုံးပြုနည်း Tarရဲ့ option တွေကိုကြည့်ရန်အတွက်
$ tar --help ဆိုပြီးရိုက်လိုက်ပါ။အာဆိုရင် tar command တွင်အသုံးပြုရမည့် optionsများကိုတွေ့ရမည်ဖြစ်သည်။
c - create a archive file
x - extract a archive file
v - verbose (show the progress of archive file)
f - filename of archive file
t - viewing content of archive file
j - filter archive through bzip2
z - filter archive through gzip
r - append or update files or directories existing archive file
အရင်ဆုံးအနေနဲ့ ကျွန်တော်တို့ fileလေးတစ်ခုကို tar command နဲ့ archive လုပ်ပါမယ်။အသုံးပြုရမည့် command ကတော့
create tar
==========
# tar -cvf test.tar file1.txt
ဒီနေရာမှာ ကျွန်တော်တို့က file1.txt ဆိုသည့် file ကို archive လုပ်မှာဖြစ်သည့်အတွက် tar option ကတော့ c ဆိုတာက create ,v ဆိုတာ verbose , f ဆိုတာကတော့ force ဖြစ်ပါသည်။ဒီ command ကိုတော့ file ကို tar နဲ့ archive လုပ်ချင်သည့်အခါတွင်အသုံးပြုပြီးတော့ Extract လုပ်ချင်ရင်တော့ အောက်ပါ Command အတိုင်းအသုံးပြုပါတယ်။
Extract tar
=========
# tar -xf test.tar
Create tar.gz file
==================
# tar -czf test.tar.gz file1.txt
Extract tar.gz file
===================
# tar -zxvf test.tar.gz
Create Zip File
===============
# zip -r test.zip file1.txt
Extract Zip File
================
# unzip test.zip
Create tar.bz2
=========
#tar -cjvf file.tar.bz2 fil1
Extract tar.bz2
================
# tar -xvf archive.tar.gz
Create tar.xz
=============
# tar cJf file.tar.xz file1
Extract tar.xz
==============
# tar -xf file.tar.xz
Last updated
Was this helpful?