centos下如何获取某个命令的源代码?
以ls命令为例,其它命令类似:
1.利用which命令获取命令可执行文件的位置:
[root@228 /]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
2.利用rpm命令获取命令所在的安装包:
[root@228 /]# rpm -qif /usr/bin/ls
Name : coreutils
Version : 8.22
Release : 15.el7
Architecture: x86_64
Install Date: Mon 23 Apr 2018 10:04:15 PM CST
Group : System Environment/Base
Size : 14581114
License : GPLv3+
Signature : RSA/SHA256, Wed 25 Nov 2015 10:22:25 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : coreutils-8.22-15.el7.src.rpm
Build Date : Fri 20 Nov 2015 01:36:57 PM CST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.gnu.org/software/coreutils/
Summary : A set of basic GNU tools commonly used in shell scripts
Description :
These are the GNU core utilities. This package is the combination of
the old GNU fileutils, sh-utils, and textutils packages.
3.利用yumdownloader命令下载对应的源安装包:
[root@228 /]# yumdownloader --source coreutils
Loaded plugins: fastestmirror, langpacks
Enabling updates-source repository
Enabling base-source repository
Enabling extras-source repository
base | 3.6 kB 00:00:00
base-source | 2.9 kB 00:00:00
extras | 3.4 kB 00:00:00
extras-source | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
updates-source | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
coreutils-8.22-21.el7.src.rpm
4.利用rpm2cpio命令提取源代码,得到源码压缩包(coreutils-8.22.tar.xz):
[root@228 /]# rpm2cpio coreutils-8.22-21.el7.src.rpm | cpio -id
11217 blocks
5.利用xz, tar命令解压即可得命令源代码:
[root@228 /]# xz -d coreutils-8.22.tar.xz
[root@228 /]# tar xvf coreutils-8.22.tar
coreutils-8.22文件夹下即可找到所需要的源代码。
centos下如何获取某个命令的源代码?的更多相关文章
- Centos下运行定时任务Crontab命令介绍
1.Cron的启动与关闭 因为Cron是Linux的内置服务.能够用下面的方法启动.关闭这个服务: /sbin/service crond start //启动服务 /sbin/s ...
- CentOS下mysql数据库常用命令总结
mysql数据库使用总结 本文主要记录一些mysql日常使用的命令,供以后查询. 1.更改root密码 mysqladmin -uroot password 'yourpassword' 2.远程登陆 ...
- centos 下 apache 重启启动命令
apache 启动 usr/local/apache243/bin/apachectl start apache 重启 usr/local/apache243/bin/apachectl restar ...
- CentOS下mysql数据库常用命令
1.更改root密码 mysqladmin -uroot password 'yourpassword' 2.远程登陆mysql服务器 mysql -uroot -p -h192.168.137.10 ...
- centos下安装ipython(minglnghang命令行)
下载文件 wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate 执行安装 python get-pip.py 这就安装好了 ...
- centos下如何停止ping命令
ctrl + c 或者 Ctrl + d(好像不行) man ping
- linux下自动获取并安装软件包 apt-get 的命令介绍
apt-cache search package 搜索包 apt-cache show package 获取包的相关信息,如说明.大小.版本等 sudo apt-get install p ...
- centos下无法使用lsof命令"-bash: lsof: command not found"
1.问题描述 : 在CentOS下,使用lsof命令,报错如下: 2.解决方法: #yum install lsof 若输入y不能安装成功,通过yum install 包 -y 进行安装: # yum ...
- 转载自php100中文网 centos下lamp 环境搭建
学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP.WAMP.MAMP等.这里我介绍一下LAMP环境的搭建,即Linux.Apache.MySQL.PHP环境. 一. ...
随机推荐
- 从工程师到技术leader思维升级
身处职场之中,太多话题相围绕,"个人成长"."管理"或许是讨论的最多的了. 但"个人成长"和"管理"却是大不相同的两件事 ...
- 我有 7种 实现web实时消息推送的方案,7种!
技术交流,公众号:程序员小富 大家好,我是小富- 我有一个朋友- 做了一个小破站,现在要实现一个站内信web消息推送的功能,对,就是下图这个小红点,一个很常用的功能. 不过他还没想好用什么方式做,这里 ...
- ajax01_基础知识
ajax请求 ajax概述 组成:asynchronous + javascript + xml 特点: 可发送异步请求(这也是与传统请求方式的区别) 用javascript语言编写代码 前后端数据交 ...
- 合并表格行---三层for循环遍历数据
合并表格行---三层for循环遍历数据 示例1 json <!DOCTYPE html> <html lang="zh_cn"> <head> ...
- mysql防SQL注入搜集
SQL注入 例:脚本逻辑 $sql = "SELECT * FROM user WHERE userid = $_GET[userid] "; 案例1:SELECT * FROM ...
- google nexus5x 刷机抓包逆向环境配置(二)
本文仅供学习交流使用,如侵立删! google nexus5x 刷入永久TWEP和Magisk(面具root) 操作环境 nexus5x kaliLinux win10 准备 下载链接:https:/ ...
- MGR的gtid_executed不连续的问题分析
GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 1.问题描述 在做MGR测试的时候偶尔遇到gtid_executed事务ID不连续的问题,但是并不影响数据库的正常运行.现 ...
- GreatSQL特性介绍及前景展望 | 数据技术嘉年华2021分享PPT发布
欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 全 ...
- python中文官方文档记录
随笔记录 python3.10中文官方文档百度网盘链接:https://pan.baidu.com/s/18XBjPzQTrZa5MLeFkT2whw?pwd=1013 提取码:1013 1.pyth ...
- Spring源码 01 概述
参考源 https://www.bilibili.com/video/BV1tR4y1F75R?spm_id_from=333.337.search-card.all.click https://ww ...