一、歸檔和壓縮
歸檔:archive
tar命令歸檔的常用選項(xiàng):
[root@linuxidc ~]# tar --helpExamples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely. 列出歸檔文件中的文件
tar -xf archive.tar # Extract all files from archive.tar.
Main operation mode:
-A, --catenate, --concatenate append tar files to an archive 追加文件到一個(gè)歸檔文件
-c, --create create a new archive 創(chuàng)建一個(gè)歸檔文件
-r, --append append files to the end of an archive 將文件追加到歸檔文件的結(jié)尾
-t, --list list the contents of an archive 列出歸檔文件的內(nèi)容
-u, --update only append files newer than copy in archive 只歸檔比歸檔文件更新的文件
-x, --extract, --get extract files from an archive 解壓歸檔文件
-C, --directory=DIR change to directory DIR 制定歸檔或解歸檔的路徑
--remove-files remove files after adding them to the archive 歸檔完成之后刪除原文件
壓縮:compress
tar命令壓縮的常用選項(xiàng):
Compression options:
filter through PROG (must accept -d)
-j, --bzip2 filter the archive through bzip2
-J, --xz filter the archive through xz
-z, --gzip, --gunzip, --ungzip filter the archive through gzip
-Z, --compress, --uncompress filter the archive through compress
[root@linuxidc tmp]# tar jcvf aa.bz2 aa
[root@linuxidc tmp]# tar zcvf aa.gz aa
[root@linuxidc tmp]# tar jxvf aa.bz2 /opt/
[root@linuxidc tmp]# tar zxvf aa.gz /opt/
cpio命令歸檔壓縮rpm安裝文件
cpio的常用選項(xiàng):
[root@linuxidc tmp]# cpio --help
Examples:
# Copy files named in name-list to the archive
cpio -o < name-list [> archive]
# Extract files from the archive
cpio -i [< archive]
# Copy files named in name-list to destination-directory
cpio -p destination-directory < name-list
Main operation mode:
-i, --extract Extract files from an archive (run in copy-in
mode)
-o, --create Create the archive (run in copy-out mode)
-p, --pass-through Run in copy-pass mode
-t, --list Print a table of contents of the input
rpm安裝包的本質(zhì)是一個(gè)壓縮包,安裝rpm包相當(dāng)于將壓縮的文件解壓縮到對(duì)應(yīng)的文件夾:
[root@linuxidc xx]# rpm2cpio ../vsftpd-3.0.2-9.el7.x86_64.rpm |cpio -id
707 blocks
[root@linuxidc xx]# ls
etc usr var xx1 xx2
2015職稱計(jì)算機(jī)考試書PowerPoint2007中 .. 定價(jià):¥45 優(yōu)惠價(jià):¥42 更多書籍 | |
2015年全國職稱計(jì)算機(jī)考試教材(2007模 .. 定價(jià):¥225 優(yōu)惠價(jià):¥213 更多書籍 |