rpm 包, jar 包的查看与解压

举报
老板上茶 发表于 2020/05/30 15:39:31 2020/05/30
【摘要】 本文介绍 rpm 包,jar 包,tar 包 查看、解压方式, 可以在不解压压缩包的情况下,查看压缩包内的内容

本文介绍 rpm 包,jar 包,tar 包 查看、解压方式, 可以在不解压压缩包的情况下,查看压缩包内的内容


一、 先说rpm 包
当前在fuxi 构建了个 mrs-manager-nodeagent-1.0.0_SNAPSHOT-20200530114200.x86_64.rpm 包


查看是否已安装: rpm -ql package-name

查看包内容: rpm -qlp package-name

解压缩rpm 包:rpm2cpio package-name | cpio -idmv


[root@node-master1fguQ ~]# rpm -ql mrs-manager-nodeagent-1.0.0_SNAPSHOT-20200530114200.x86_64.rpm
package mrs-manager-nodeagent-1.0.0_SNAPSHOT-20200530114200.x86_64.rpm is not installed

[root@node-master1fguQ ~]# rpm -qlp mrs-manager-nodeagent-1.0.0_SNAPSHOT-20200530114200.x86_64.rpm
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/agent-0.0.1.tar.gz
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/config-nodestrust.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/constants.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/download.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/functions.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/installnodeagent.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/log.sh
/tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/rpm_install_nodeagent.sh


[root@node-master1fguQ ~]# rpm2cpio mrs-manager-nodeagent-1.0.0_SNAPSHOT-20200530114200.x86_64.rpm | cpio -idmv
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/agent-0.0.1.tar.gz
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/config-nodestrust.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/constants.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/download.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/functions.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/installnodeagent.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/log.sh
./tmp/mrs-manager-nodeagent-1.0.0_SNAPSHOT/rpm_install_nodeagent.sh
227939 blocks


二、 jar 包


查看jar 包内容:jar tf Test.jar

解压jar 包: jar xf xx.jar


[root@node-master1fguQ ~]# jar tf agent-0.0.1.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/huawei/
com/huawei/bigdata/
com/huawei/bigdata/om/
com/huawei/bigdata/om/agent/
com/huawei/bigdata/om/agent/actions/

[root@node-master1fguQ ~]# jar tf agent-0.0.1.jar | grep ObsClient.class
com/huawei/bigdata/om/agent/util/ObsClient.class

[root@node-master1fguQ ~]# jar xf agent-0.0.1.jar
[root@node-master1fguQ ~]# ls
agent-0.0.1.jar com


三、 tar 包 

解压:tar -xvzf xxx.tar.gz
压缩: tar -cvzf xxx.tar.gz xx xx
查看:tar -tvzf xxx.tar.gz

提取某一文件出来: tar -xvzf xxx.tar.gz fileyourneed

[root@node-master1fguQ mrs-manager-nodeagent-1.0.0_SNAPSHOT]# tar -tzvf agent-0.0.1.tar.gz
-rw-r----- root/root 5949440 2020-05-30 11:44 setup/oma/OMA-V100R001C00.x86_64.tar
-rw-r----- root/root 113240 2020-05-30 11:44 setup/oma/libpmaplugin.so
-rwxr-xr-x root/root 526 2020-05-30 11:50 bin/oss/euleros/cmd.sh
-rwxr-xr-x root/root 932 2020-05-30 11:50 bin/oss/euleros/func.sh
-rwxr-xr-x root/root 875 2020-05-30 11:50 bin/oss/euleros/interface.sh
-rwxr-xr-x root/root 875 2020-05-30 11:50 bin/oss/interface/interface.sh


[root@node-master1AkQQ mrs-manager-nodeagent-1.0.0_SNAPSHOT]# tar tvzf agent-0.0.1.tar.gz  | grep pmaplugin

-rw-r----- root/root    113904 2020-06-12 18:09 setup/oma/libpmaplugin.so

[root@node-master1AkQQ mrs-manager-nodeagent-1.0.0_SNAPSHOT]# tar xvzf agent-0.0.1.tar.gz setup/oma/libpmaplugin.so

setup/oma/libpmaplugin.so

[root@node-master1AkQQ mrs-manager-nodeagent-1.0.0_SNAPSHOT]# ls setup/oma/

libpmaplugin.so


此外,

jar 文件也可用用 unzip -p, unzip -l 查看


jar文件列表:unzip -l xxx.jar

查看压缩文件内的具体内容: unzip -p xxx.jar filename 
[root@node-master1fguQ ~]# unzip -l agent-0.0.1.jar
Archive: agent-0.0.1.jar
Length Date Time Name
--------- ---------- ----- ----
0 05-29-2020 20:17 META-INF/
228 05-29-2020 20:17 META-INF/MANIFEST.MF
0 05-29-2020 20:15 com/
0 05-29-2020 20:15 com/huawei/
0 05-29-2020 20:15 com/huawei/bigdata/
0 05-29-2020 20:15 com/huawei/bigdata/om/
0 05-29-2020 20:15 com/huawei/bigdata/om/agent/
0 05-29-2020 20:15 com/huawei/bigdata/om/agent/actions/
0 05-29-2020 20:15 com/huawei/bigdata/om/agent/actions/handlers/


[root@node-master1fguQ ~]# unzip -p agent-0.0.1.jar META-INF/maven/com.huawei.bigdata.om/agent/pom.properties
#Generated by Maven
#Fri May 29 20:17:15 CST 2020
version=0.0.1
groupId=com.huawei.bigdata.om
artifactId=agent


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。