tar 壓縮命令的最有用的一個選項了

tar cf - rootfs.rls | ssh [email protected]  "tar -C /home/et3320 -xvf -"


把整個的rootfs.rls目錄給上傳到1.2的/home/et3320目錄。 且tar不改變任何連接和文件等的信息。

注意的一點是,打包和登陸的用戶都必須是root用戶,否則,某些文件或者設備會丟失。

Because tar saves the ownership and permissions of files in the archive and retains the full
directory structure, as well as symbolic and hard links, using tar is an excellent way to copy
or move an entire directory tree from one place to another on the same system (or even
between different systems, as we'll see).

And tar allows you to write an ahchive to standard output. If you specify a - as the tar file to read or write, the data will be read from or write to the standard input or standard output. 

We start in the directory rootfs and create a tar file of the current directory, which is written to standard output. This archive is read by a ssh  and then runs tar xvf, reading from standard input. No tar file is ever written to disk; the data is sent entirely via pipe from one tar process to another. The second tar process has the v option that prints each file as it's extracted; in this way, we can verify that the command is working as expected.
 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章