如何通过apt-get获得安装包的源码

本文介绍如何使用apt-get命令获取tree工具的源码,并展示获取过程及生成的源码文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有时候我们需要获得某个可执行程序的源码,而不仅仅是一个可执行程序,比如我们想获取tree这个工具的源码,这时候就可以采用下面的命令:

 

sudo apt-get source tree

 

pengdl@debian:~$ sudo apt-get source tree
Reading package lists... Done
Building dependency tree       
Reading state information... Done
NOTICE: 'tree' packaging is maintained in the 'Git' version control system at:
git://git.debian.org/collab-maint/tree.git
Need to get 49.8 kB of source archives.
Get:1 http://mirrors.163.com/debian/ wheezy/main tree 1.6.0-1 (dsc) [1,145 B]
Get:2 http://mirrors.163.com/debian/ wheezy/main tree 1.6.0-1 (tar) [42.7 kB]
Get:3 http://mirrors.163.com/debian/ wheezy/main tree 1.6.0-1 (diff) [5,916 B]
Fetched 49.8 kB in 0s (78.9 kB/s)
gpgv: keyblock resource `/root/.gnupg/trustedkeys.gpg': file open error
gpgv: Signature made Sat 04 Feb 2012 08:33:55 AM EST using DSA key ID 514B3E7C
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./tree_1.6.0-1.dsc
dpkg-source: info: extracting tree in tree-1.6.0
dpkg-source: info: unpacking tree_1.6.0.orig.tar.gz
dpkg-source: info: unpacking tree_1.6.0-1.debian.tar.gz
dpkg-source: info: applying 01_Makefile_fix
dpkg-source: info: applying 02_PATH_MAX

 

执行完成之后,就会在当前目录生成如下几个文件:

tree-1.6.0
tree_1.6.0-1.dsc
tree_1.6.0-1.debian.tar.gz
tree_1.6.0.orig.tar.gz

其中目录tree-1.6.0中就是想要的tree的源码了,根据其中的提示可以手工编译生成目标机器上的tree命令。

转载于:https://www.cnblogs.com/pengdonglin137/p/3508003.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值