好程式設計師雲端計算學習路線分享檔案打包及壓縮

好程式設計師IT發表於2019-09-25

好程式設計師雲端計算學習路線分享檔案打包及壓縮, 建議針對目錄

Demo: 複製未打包的檔案到遠端主機
[root@yangs ~]# du -sh /etc
39M /etc
[root@yangs ~]# time scp -r /etc root@192.168.5.32:/tmp //將/etc目錄...

===打包,壓縮===
[root@yangs ~]# tar -cz f etc1.tar.gz  /etc //-z 呼叫gzip : tar removeing 非報錯
[root@yangs ~]# tar -cj f etc2.tar.bz2  /etc //-j 呼叫bzip2
[root@yangs ~]# tar -cJ f etc3.tar.xz  /etc //-J 呼叫xz
[root@yangs ~]# ll -h etc*
-rw-r--r--. 1 root root 8.7M 3月 12 00:08 etc1.tar.gz
-rw-r--r--. 1 root root 7.5M 3月 12 00:08 etc2.tar.bz2
-rw-r--r--. 1 root root 4.8M 3月 12 00:09 etc3.tar.xz

===解壓,解包===
[root@yangs ~]# tar -tf sys.tar.xz
[root@yangs ~]# tar -xzvf etc1.tar.gz
[root@yangs ~]# tar -xvf etc1.tar.gz //無需指定解壓工具,tar會自動判斷
[root@yangs ~]# tar -xvf etc2.tar.bz2 -C /tmp //-C重定向到//tmp目錄
[root@yangs ~]# tar xf etc3.tar.xz !!!!!!!!!!!!!!!自動尋找 記住這個就好了

file 可檢視
==解壓zip
[root@yangs ~]# unzip xxx.zip
====================================================================================

--------------------------------------------------
壓縮打包
gzip bzip2
[root@localhost tmp]# dd if=/dev/zero of=/tmp/data bs=100M count=2
in file out file block size count
[root@localhost tmp]# du -sh data -s 總共 -h 最大單位
[root@localhost tmp]# gzip data
[root@localhost tmp]# gunzip data.gz
[root@localhost tmp]# bzip2 data
[root@localhost tmp]# bunzip2 data.bz2

tar
[root@localhost tmp]# tar -cvf boot.tar /boot/ -c 建立 -v 顯示過程 -f 檔案
[root@localhost tmp]# tar -tvf boot.tar -t 檢視
[root@localhost tmp]# tar -rvf boot.tar /root/install.log -r 追加打包
[root@localhost tmp]# tar -xvf boot.tar

[root@localhost tmp]# tar -cvf /home/boot.tar /boot/ 指定包存放路徑
[root@localhost tmp]# tar -xvf /tmp/boot.tar -C /home/ 指定解壓目錄

呼叫gzip壓縮
[root@localhost tmp]# tar -zcvf boot.tar.gz /boot/
[root@localhost tmp]# tar -ztvf boot.tar.gz
[root@localhost tmp]# tar -zxvf boot.tar.gz

呼叫bzip2壓縮
[root@localhost tmp]# tar -jcvf boot.tar.bz2 /boot/
[root@localhost tmp]# tar -jtvf boot.tar.bz2
[root@localhost tmp]# tar -jxvf boot.tar.bz2




[root@localhost Packages]# rpm -ivh tree-1.5.3-2.el6.x86_64.rpm
-i 安裝 -v顯示過程 -h顯示百分比
[root@localhost Packages]# rpm -q tree -q 檢索
[root@localhost Packages]# rpm -qa | grep httpd 檢索所有軟體
[root@localhost Packages]# rpm -ql httpd 列出httpd所有檔案位置
[root@localhost Packages]# rpm -ql httpd | cut -d \/ -f 2 | uniq
[root@localhost Packages]# rpm -qi tree 列出軟體包資訊
[root@localhost Packages]# rpm -qd httpd 檢視軟體文件
[root@localhost Packages]# rpm -qc httpd 檢視配置檔案
[root@localhost Packages]# rpm -qf /etc/man.config 透過檔案查詢對應軟體包
[root@localhost Packages]# rpm -qf `which mount` 查詢命令對應軟體
[root@localhost Packages]# rpm -e tree 解除安裝
[root@localhost Packages]# rpm -ivh httpd-2.2.15-26.el6.x86_64.rpm --force 強制安裝

未按裝
[root@localhost Packages]# rpm -qpi tree-1.5.3-2.el6.x86_64.rpm
[root@localhost Packages]# rpm -qpl tree-1.5.3-2.el6.x86_64.rpm

解決依賴關係
[root@localhost Packages]# rpm -ivh httpd-devel-2.2.15-26.el6.x86_64.rpm
warning: httpd-devel-2.2.15-26.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
apr-devel is needed by httpd-devel-2.2.15-26.el6.x86_64
apr-util-devel is needed by httpd-devel-2.2.15-26.el6.x86_64

[root@localhost Packages]# rpm -ivh apr-devel-1.3.9-5.el6_2.x86_64.rpm
warning: apr-devel-1.3.9-5.el6_2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:apr-devel ########################################### [100%]

[root@localhost Packages]# rpm -ivh apr-util-devel-1.3.9-3.el6_0.1.x86_64.rpm
warning: apr-util-devel-1.3.9-3.el6_0.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
expat-devel is needed by apr-util-devel-1.3.9-3.el6_0.1.x86_64

[root@localhost Packages]# rpm -ivh expat-devel-2.0.1-11.el6_2.x86_64.rpm
warning: expat-devel-2.0.1-11.el6_2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:expat-devel ########################################### [100%]

[root@localhost Packages]# rpm -ivh apr-util-devel-1.3.9-3.el6_0.1.x86_64.rpm
warning: apr-util-devel-1.3.9-3.el6_0.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:apr-util-devel ########################################### [100%]

[root@localhost Packages]# rpm -ivh httpd-devel-2.2.15-26.el6.x86_64.rpm
warning: httpd-devel-2.2.15-26.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:httpd-devel ########################################### [100%]

[root@localhost Packages]# rpm -e apr-devel --nodeps 不檢測依賴關係解除安裝

yum庫的使用
1.[root@localhost mnt]# mkdir /yum
[root@localhost mnt]# mount -t iso9660 -o loop /var/ftp/rhel-server-6.4-x86_64-dvd.iso /yum/
2.[root@localhost mnt]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# touch yum.repo
[root@localhost yum.repos.d]# vim yum.repo
[rhel6.4] ------------------------庫名字
name=rhel6.4 server -------------描述
baseurl=file:///yum -------------路徑
gpgcheck=0 ----------------------是否校驗key
enabled=1 -----------------------開啟或者關閉


測試
[root@localhost yum.repos.d]# yum clean all 清除yum快取
[root@localhost yum.repos.d]# yum makecache 建立yum快取
[root@localhost yum.repos.d]# yum install httpd-devel 安裝
[root@localhost yum.repos.d]# yum install -y httpd-devel
[root@localhost yum.repos.d]# yum reinstall -y httpd-devel 重新安裝
[root@localhost yum.repos.d]# yum remove apr-devel 移除軟體包

onal Development" "Development tools"


[root@localhost software]# chmod +x RealPlayer\®\;\ 11\ for\ Linux\ RealPlayer11GOLD.bin
[root@localhost software]# ./RealPlayer\®\;\ 11\ for\ Linux\ RealPlayer11GOLD.bin

[root@localhost software]# realplay

原始碼包lftp-3.5.10.tar.bz2
[root@localhost lftp-3.5.10]# rpm -e lftp 解除安裝rpm包的lftp
[root@localhost software]# tar -jxvf lftp-3.5.10.tar.bz2 -C /usr/local/src/
編譯前檢測和配置
[root@localhost lftp-3.5.10]# ./configure --prefix=/usr/local/lftp
編譯
[root@localhost lftp-3.5.10]# make
安裝
[root@localhost lftp-3.5.10]# make install
測試
[root@localhost lftp-3.5.10]# /usr/local/lftp/bin/lftp 172.16.110.1

[root@localhost lftp-3.5.10]# vim /etc/bashrc
PATH=/usr/local/lftp/bin:$PATH
export PATH

[root@localhost lftp-3.5.10]# lftp 172.16.110.1
lftp 172.16.110.1:/> ls
lftp 172.16.110.1:/> get biji.txt

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69913892/viewspace-2657929/,如需轉載,請註明出處,否則將追究法律責任。

相關文章