总结:

通过先通过which找到命令路径path

rpm -qf  path 获取源码名称n

rpm -qi n   获取源码地址

[root@d mongoexport]# rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--triggeredby query the package(s) triggered by the package
--whatrequires query/verify the package(s) which require a dependency
--whatprovides query/verify the package(s) which provide a dependency
--nomanifest do not process non-package files as manifests

Query options (with -q or --query):
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files
-L, --licensefiles list all license files
--dump dump basic file information
-l, --list list files in package
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files

Verify options (with -V or --verify):
--nofiledigest don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)

Install/Upgrade/Erase options:
--allfiles install all files, even configurations which might otherwise be skipped
--allmatches remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)
--badreloc relocate files in non-relocatable package
-e, --erase=<package>+ erase (uninstall) package
--excludedocs do not install documentation
--excludepath=<path> skip files with leading component <path>
--force short hand for --replacepkgs --replacefiles
-F, --freshen=<packagefile>+ upgrade package(s) if already installed
-h, --hash print hash marks as package installs (good with -v)
--ignorearch don't verify package architecture
--ignoreos don't verify package operating system
--ignoresize don't check disk space before installing
-i, --install install package(s)
--justdb update the database, but do not modify the filesystem
--nodeps do not verify package dependencies
--nofiledigest don't verify digest of files
--nocontexts don't install file security contexts
--noorder do not reorder package installation to satisfy dependencies
--noscripts do not execute package scriptlet(s)
--notriggers do not execute any scriptlet(s) triggered by this package
--nocollections do not perform any collection actions
--oldpackage upgrade to an old version of the package (--force on upgrades does this automatically)
--percent print percentages as package installs
--prefix=<dir> relocate the package to <dir>, if relocatable
--relocate=<old>=<new> relocate files from path <old> to <new>
--replacefiles ignore file conflicts between packages
--replacepkgs reinstall if the package is already present
--test don't install, but tell if it would work or not
-U, --upgrade=<packagefile>+ upgrade package(s)
--reinstall=<packagefile>+ reinstall package(s)

Common options for all rpm modes and executables:
-D, --define='MACRO EXPR' define MACRO with value EXPR
--undefine=MACRO undefine MACRO
-E, --eval='EXPR' print macro expansion of EXPR
--macros=<FILE:...> read <FILE:...> instead of default file(s)
--noplugins don't enable any plugins
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--rcfile=<FILE:...> read <FILE:...> instead of default file(s)
-r, --root=ROOT use ROOT as top level directory (default: "/")
--dbpath=DIRECTORY use database in DIRECTORY
--querytags display known query tags
--showrc display final rpmrc and macro configuration
--quiet provide less detailed output
-v, --verbose provide more detailed output
--version print the version of rpm being used

Options implemented via popt alias/exec:
--scripts list install/erase scriptlets from package(s)
--setperms set permissions of files in a package
--setugids set user/group ownership of files in a package
--conflicts list capabilities this package conflicts with
--obsoletes list other packages removed by installing this package
--provides list capabilities that this package provides
--requires list capabilities required by package(s)
--info list descriptive information from package(s)
--changelog list change logs for this package
--xml list metadata in xml
--triggers list trigger scriptlets from package(s)
--last list package(s) by install time, most recent first
--dupes list duplicated packages
--filesbypkg list all files from each package
--fileclass list file names with classes
--filecolor list file names with colors
--fscontext list file names with security context from file system
--fileprovide list file names with provides
--filerequire list file names with requires
--filecaps list file names with POSIX1.e capabilities

Help options:
-?, --help Show this help message
--usage Display brief usage message
[root@d mongoexport]#

[root@d mongoexport]# which bzip2
/usr/bin/bzip2
[root@d mongoexport]# rpm -qf /usr/bin/bzip2
bzip2-1.0.6-13.el7.x86_64
[root@d mongoexport]# rpm -qi bzip2-1.0.6-13.el7.x86_64
Name : bzip2
Version : 1.0.6
Release : 13.el7
Architecture: x86_64
Install Date: Thu 09 Feb 2017 02:06:41 PM CST
Group : Applications/File
Size : 83791
License : BSD
Signature : RSA/SHA256, Wed 25 Nov 2015 10:18:37 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : bzip2-1.0.6-13.el7.src.rpm
Build Date : Fri 20 Nov 2015 01:04:52 PM CST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.bzip.org/
Summary : A file compression utility
Description :
Bzip2 is a freely available, patent-free, high quality data compressor.
Bzip2 compresses files to within 10 to 15 percent of the capabilities
of the best techniques available. However, bzip2 has the added benefit
of being approximately two times faster at compression and six times
faster at decompression than those techniques. Bzip2 is not the
fastest compression utility, but it does strike a balance between speed
and compression capability.

Install bzip2 if you need a compression utility.
[root@d mongoexport]#

获取linux工具命令源码的更多相关文章

  1. Linux 查看命令源码

    一.简介 有时候想看看ls.cat.more等命令的源代码,本文介绍相应查看方法. 二.方法 参考: http://blog.csdn.net/silentpebble/article/details ...

  2. linux下命令源码

    一般来说,不同的命令可能隶属于不同的软件包,这样就没有一个地方会有所有命令的源代码.(命令的个数也会与你所安装的软件包有关)但是,一些常用的命令,例如basename cat chgrp chmod ...

  3. linux 软件管理--yum工具及源码包

    目录 linux 软件管理--yum工具及源码包 一.yum基本概述 二.yum源的配置 三.yum实践案例 四.yum全局配置文件 五.yum签名检查机制 五.制作本地yum仓库 六.构建企业级yu ...

  4. 用Diff和Patch工具维护源码

    在Unix系统下,维护源码版本可以使用很多方法,其中最常用的当然是大名鼎鼎的CVS,但实际上,简单的版本维护工作并没有必要使用复杂的CVS等专门的版本维护工具,Unix标配中的diff和patch工具 ...

  5. yum工具及源码包

    目录 yum工具及源码包 yum yum源 yum实战案例 yum全局配置文件 制作本地yum仓库 构建企业级yum仓库 源码包 yum工具及源码包 yum yum是RedHat以及CentOS中的软 ...

  6. http代理工具delphi源码

    http://www.caihongnet.com/content/xingyexinwen/2013/0721/730.html http代理工具delphi源码 以下代码在 DELPHI7+IND ...

  7. 并发工具CyclicBarrier源码分析及应用

      本文首发于微信公众号[猿灯塔],转载引用请说明出处 今天呢!灯塔君跟大家讲: 并发工具CyclicBarrier源码分析及应用 一.CyclicBarrier简介 1.简介 CyclicBarri ...

  8. 一篇文章看懂TPCx-BB(大数据基准测试工具)源码

    TPCx-BB是大数据基准测试工具,它通过模拟零售商的30个应用场景,执行30个查询来衡量基于Hadoop的大数据系统的包括硬件和软件的性能.其中一些场景还用到了机器学习算法(聚类.线性回归等).为了 ...

  9. Linux环境PostgreSQL源码编译安装

    Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...

随机推荐

  1. 第四章 TCP粘包/拆包问题的解决之道---4.2--- 未考虑TCP粘包导致功能异常案例

    4.2 未考虑TCP粘包导致功能异常案例 如果代码没有考虑粘包/拆包问题,往往会出现解码错位或者错误,导致程序不能正常工作. 4.2.1 TimeServer 的改造 Class : TimeServ ...

  2. ubuntu 13.04 nginx.conf 配置详解

    1.nginx.conf 文件,路径为:/etc/nginx/agin.conf #使用的用户和组 user www-data; #指定工作衍生进程数(一般等于CPU总核数或总核数的两倍) worke ...

  3. NuGet的几个小技巧(转)

    NuGet的几个小技巧   因为可视化库程序包管理器的局限性,有很多需要的功能在界面中无法完成. 以下技巧均需要在“程序包管理器控制台”中使用命令来完成. 一.改变项目目标框架后,更新程序包 当改变项 ...

  4. pip更换下载源(提升下载速度)

    经常在使用Python的时候需要安装各种模块,而pip是很强大的模块安装工具,但是由于国外官方pypi经常被墙,导致不可用,或者下载速度很慢,所以我们最好是将自己使用的pip源更换一下,这样就能解决被 ...

  5. COM组件没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))

    1.解决办法:在项目属性里设置“生成”=>“目标平台”为x86而不是默认的ANY CPU:

  6. 【DVWA】Web漏洞实战之File Upload

    File Upload File Upload,即文件上传漏洞,一般的上传漏洞可能是未验证上传后缀 或者是验证上传后缀被bypass 或者是上传的文件验证了上传后缀但是文件名不重命名. LOW 直接上 ...

  7. 团购已满,O2O只是个笑话吗?

    团购的用户习惯经过多年的“发酵”以后,大多数用户的团购习惯已经养成,同样一张电影票团购和直接现场购买的差价在一倍以上,当然O2O领域的其他情况也差不多,面对明显的“优惠”,用户当然乐意使用团购服务. ...

  8. oracle数据据 Python+Pandas 获取Oracle数据库并加入DataFrame

    import pandas as pd import sys import imp imp.reload(sys) from sqlalchemy import create_engine impor ...

  9. linux shell 随机字符生成单词

    #!/bin/sh #生成随机5个单词 filecount= wordcount= flag= #-lt -le -gt -ge -eq #while [ $f -lt $filecount ]; # ...

  10. .vimrc设置说明

    在终端下使用vim进行编辑时,默认情况下, 编辑的界面上是没有显示行号.语法高亮度显示.智能缩进等功能的. 为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc. 在启动vim时,当前 ...