tar,gzip,bzip2ã«ã¤ãã¦
tarã³ãã³ãã¨tarãã¼ã«
tarã³ãã³ãã¯ãtarãã¼ã«ã¨ããå½¢å¼ã®1ã¤ã®ãã¡ã¤ã«ã«è¤æ°ã®ãã¡ã¤ã«ããã£ã¬ã¯ããªãã¾ã¨ããã¿ã¤ã ã¹ã¿ã³ããã¢ã¯ã»ã¹æ¨©ãææè
ã®æ
å ±ãæ ¼ç´ãããããã¼ã¿ã®å§ç¸®ã¯è¡ããªãã*1
ã¾ã¨ããtarãã¼ã«ã¯ãå¥éå§ç¸®ãè¡ããã¨ã§ãä»ã®å¤ãã®å§ç¸®å½¢å¼ã®ãããªãè¤æ°ãã¡ã¤ã«ãã¾ã¨ãã¦å§ç¸®ããå®ç¾ã§ãããä¸è¦é¢åããã§ã¯ããã®ã ããå§ç¸®æ¹å¼ãèªç±ã¨ããã®ã¯å©ç¹ã¨è¨ãããä¸é¨ã®å§ç¸®å½¢å¼(gzipã¨bzip2)ã«é¢ãã¦ã¯ããã®2段éã®å¦çã1度ã§è¡ã£ã¦ããããå§ç¸®çã®é«ã7zå½¢å¼ã§ã¯ã多少面倒になるããå§ç¸®çãåªå
ããã®ã§ããã°ã使ã価å¤ããã(p7zipã¨ããããã±ã¼ã¸ãå¿
è¦)ã
å®éã®ä½¿ãæ¹ã¯ãä¾ãåèã«ããã»ãããé·ãããã¥ã¢ã«ãèªããããåãããããã
以ä¸ã®ä¾ã§ã¯ãå¦çããããã¡ã¤ã«ãªã©ã詳細ã«è¡¨ç¤ºããvãªãã·ã§ã³ãä»ãã¦ããããä»ããªãã¦ããã¡ã¤ã«ã®å¦çã¯è¡ãããã
tarãã¼ã«ãæ°è¦ä½æ
$ tar cvf test.tar [ãã¡ã¤ã«ãããã¯ãã£ã¬ã¯ããª...]
tarãã¼ã«ãç¾å¨ãããã£ã¬ã¯ããªã«å±é
$ tar xvf test.tar
tarãã¼ã«ãæå®ãã£ã¬ã¯ããªä»¥ä¸ã«å±é
$ tar xvf test.tar -C [ãã£ã¬ã¯ããª]
tarãã¼ã«ã®å 容ãä¸è¦§
$ tar tvf test.tar
æ¢åã®tarãã¼ã«ã«ãã¡ã¤ã«ããã£ã¬ã¯ããªã追å
$ tar rvf test.tar [ãã¡ã¤ã«ãããã¯ãã£ã¬ã¯ããª...]
tarãã¼ã«ãä½æããéã«ã/ãããå§ã¾ããã«ãã¹ãæå®ããå ´åãå é ã®ã/ããåããããä¾ãã°
$ tar cvf usrlocal.tar /usr/local/
ã¨ããå ´åãå±éãããã¨ãã«ã¯ãusr/以ä¸ã¨ãã(å±éãããé層ããã®)ç¸å¯¾çãªå ´æã¨ãªãã
å®å
¨ãªãã¹åãä¿åãã復å
ãããã®ã§ããã°ã-Pãªãã·ã§ã³ãtarãã¼ã«ä½ææã¨å±éæã®ä¸¡æ¹ã«ä»ãããä¸ã®ä¾ã§ã¯ãä¸è¬ã¦ã¼ã¶ã§æ¸ãè¾¼ããªãå ´æã«å±éããããããsudoã使ç¨ãã¦ããã
$ tar cvf usrlocal.tar /usr/local/ -P $ sudo tar xvf usrlocal.tar -P
gzipã¨bzip2
- å§ç¸®ã³ãã³ãã¯ããããããgzipãã¨ãbzip2ãã
- å±éã³ãã³ãã¯ããããããunããä»ãã¦ããgunzipãã¨ãbunzip2ãã
- ã©ã¡ããã1ã¤ã®ãã¡ã¤ã«ã®ã¿å§ç¸®ããè¤æ°ã®ãã¡ã¤ã«ãã¾ã¨ãããã¨ã¯ããªãã
- å§ç¸®ããããã¡ã¤ã«ã®æ¡å¼µåã¯ãããããã.gzãã.bz2ãã
- å§ç¸®çã¯bzip2ã®ã»ããé«ãã
- zcat(gzip)ãbzcat(bzip2)ã¨ãã£ãã³ãã³ãã§ç°¡åã«å§ç¸®ããããã¼ã¿ãèªãããããå°ããªããã¹ããã¡ã¤ã«(æ¸å¼æ å ±ãå«ã¾ãªãããã¬ã¼ã³ããã¹ã)ãå§ç¸®ããã®ã«ã使ããããEmacs 22ã§ã¯ãgzip/bzip2å§ç¸®ãããããã¹ããã¡ã¤ã«ãéãã¨ãèªåçã«å±éãã¦ããã¦ãå ã®ããã¹ããã¼ã¿ã表示ããæ¸ãè¾¼ãã¨ãã«ã¯å§ç¸®ãã¦ããã(å§ç¸®ãæèããã«(ééçã«)æ±ãããã¨ããã)ã
gzipå§ç¸®(æé«å§ç¸®)
$ gzip -9 [ãã¡ã¤ã«ã®å ´æ]
bzip2å§ç¸®
$ bzip2 [ãã¡ã¤ã«ã®å ´æ]
å ã®ãã¡ã¤ã«ãæ®ã
gzipã¨bzip2ã³ãã³ãã¯ãæå®ãããã¡ã¤ã«ãå§ç¸®ããå¾ãå
ã®ãã¡ã¤ã«ãåé¤ãã¦ãã¾ãããã®å ´åãæ¡å¼µåã¯èªåçã«ä»ããããã
ä¸ã®ä¾ã¯ãtest.txtã¨ãããã¡ã¤ã«ãç¨æããå ´åã
$ ls test.txt $ bzip2 test.txt; ls test.txt.bz2
ãããå ã®ãã¡ã¤ã«ãæ®ãããã®ã§ããã°ã-cãªãã·ã§ã³ã§æ¨æºåºåã«(å§ç¸®å¾ã®)ãã¡ã¤ã«ãåºåããããã®å ´åãæ¡å¼µåãå«ããåºåãã¡ã¤ã«åã¯èªåã§æ¸ãã
$ bzip2 -c test.txt > test.txt.bz2; ls test.txt test.txt.bz2
å±éæã«å ã®ãã¡ã¤ã«ãæ®ãããå ´åããå§ç¸®ãã¡ã¤ã«ã«æ¸ãè¾¼ã¿æ¨©éãç¡ãå ´åãªã©ã«ã¯ãzcatã¨bzcatã³ãã³ããå½¹ã«ç«ã¤ããããã¯ãgunzipãbunzip2ã«-cãªãã·ã§ã³ãä»ãããã®ã¨ç価ã
å§ç¸®ãããtarãã¼ã«ã®ä½æã¨å±é
tarã³ãã³ãã§ä½æããtarãã¼ã«ãæ®éã«å§ç¸®ãããã¨ãã§ããããããã§ã¯2段éã®æä½ã«ãªããããããç°¡åã«ã§ããæä½ãåå¨ããããã ãã以ä¸ã§è¿°ã¹ãtarã³ãã³ãã®zãjã¨ãã£ããªãã·ã§ã³ã¯ãGNUç以å¤ã®tarã§ã¯åä½ããªããããããªãã
ä½æã¨å±é以å¤ã®æä½(ä¾: tar jtvf test.tar.bz2)ãåæ§ã«å¯è½ã ããçç¥ã
.tar.gzãã¡ã¤ã«ã®ä½æ
$ tar zcvf test.tar.gz [ãã¡ã¤ã«ããã£ã¬ã¯ããª...] ããã㯠$ tar cv [ãã¡ã¤ã«ããã£ã¬ã¯ããª...] | gzip > test.tar.gz
.tar.bz2ãã¡ã¤ã«ã®ä½æ
$ tar jcvf test.tar.bz2 [ãã¡ã¤ã«ããã£ã¬ã¯ããª...] ããã㯠$ tar cv [ãã¡ã¤ã«ããã£ã¬ã¯ããª...] | bzip2 > test.tar.bz2
.tar.gzãã¡ã¤ã«ã®å±é
$ tar zxvf test.tar.gz ããã㯠$ zcat test.tar.gz | tar xvf -
.tar.bz2ãã¡ã¤ã«ã®å±é
$ tar jxvf test.tar.gz ããã㯠$ bzcat test.tar.bz2 | tar xvf -
tar+gzipã¨tar+bzip2ã®æ¡å¼µå
ãããããã.tar.gzãã¨ã.tar.bz2ããä¸è¬çã ããã.tgzããã.tbzãã¨ããç縮形ãåå¨ããã
GUIã§å§ç¸®tarãã¼ã«ãä½æ/å±é
file-rollerãxarchiverãªã©ã®ã¢ããªã±ã¼ã·ã§ã³ã使ç¨ãããã¨ã§ãç°¡åã«ä½æã¨å±éãã§ãããå®éã«ã¯NautilusãThunarã¨ãã£ãGUIãã¡ã¤ã«ããã¼ã¸ã£ããå³ã¯ãªãã¯ã¡ãã¥ã¼ã§ãæ¸åº«ã®ä½æããããã«å±éãããã¨ãã£ãé ç®ãé¸æããã°ããã ãã§ãé常ã«ãæ軽ã
é¢é£è¨äº:
*1:ã¾ã¨ããå ã®ãã¡ã¤ã«ã®ãµã¤ãºãå°ãããã®ã°ããã§ããã°ããã¡ã¤ã«ã·ã¹ãã ã«ããããã£ã¹ã¯é åã®ä½¿ç¨ãããç¨åº¦å¹ççã«ãªããããã«ããå¤å°ã¯å®¹éã®ç¯ç´ã«ãªããããããªãã...