你在哪里下载Linux源代码?

时间:2022-09-02 09:29:53

Say I'm interested in the source for one particular Linux utility, like factor. Where can I find the source code for that utility?

假设我对某个特定Linux实用程序的源代码感兴趣,比如因素。我在哪里可以找到该实用程序的源代码?

8 个解决方案

#1


9  

What I did was type

我做的是打字

man factor

and went to the bottom and found 'GNU coreutils 6.10'. So I googled 'coreutils' and... found the site joschi just linked to.

然后走到最底层,发现'GNU coreutils 6.10'。所以我用谷歌搜索'coreutils'并且......发现了joschi刚刚链接到的网站。

#2


14  

You can also find out which package the binary comes from an download that packages source code.

您还可以找到包含源代码的下载包含二进制文件的包。

On Debian (and Ubuntu and anything else that's based on Debian) you do that like this:

在Debian(以及Ubuntu和其他任何基于Debian的东西)上你这样做:

$ dpkg -S /usr/bin/factor
coreutils: /usr/bin/factor
$ apt-get source coreutils

The first command will check which package contains the file you are searching for (use "which factor" to find out which binary is executed when you just type "factor").

第一个命令将检查哪个包包含您要搜索的文件(使用“which factor”查找当您键入“factor”时执行的二进制文件)。

The second command will download and unpack the sources (including the patches applied to build the package) to the current directory, so it should be executed in a dedicated or temporary directory.

第二个命令将下载源代码(包括用于构建程序包的补丁程序包)并将其解压缩到当前目录,因此应该在专用或临时目录中执行。

I'm pretty sure rpm-based distributions have a similar mechanism, but I don't know their commands.

我很确定基于rpm的发行版有类似的机制,但我不知道它们的命令。

#3


5  

To find the package a binary comes from, in rpm based system, you might type:

要查找二进制文件包,在基于rpm的系统中,您可以键入:

$ rpm -qf /usr/bin/factor

which will print the package name. Instead, with:

这将打印包名称。相反,用:

$ rpm -qif /usr/bin/factor

you will get also information on a package, including it's home page in many cases.

您将获得有关包裹的信息,包括许多情况下的主页。

Source rpms also exist, but how to get them depends on the high-level package manager used on top of RPM (yum, urpmi, apt-get4 for rpm, ...).

源rpms也存在,但如何获取它们取决于在RPM之上使用的高级包管理器(yum,urpmi,apt-get4 for rpm,...)。

On most systems, also, /usr/share/doc/ contains some documentation on the program, and the website link is pretty often found somewhere there, maybe in the README.

在大多数系统上,/ usr / share / doc /还包含有关该程序的一些文档,并且网站链接经常在那里找到,可能在README中。

#4


4  

Usually you'll find the source code on the website of the program if it is open source. In this case here since factor is part of coreutils.

通常,如果它是开源的,你会在程序的网站上找到源代码。在这种情况下,因为因素是coreutils的一部分。

#5


3  

On Gentoo, simply look in the ebuild you compiled the package with :D.

在Gentoo上,只需查看编译包的ebuild:D。

If you're not sure?

如果你不确定?

    # which factor 
    /usr/bin/factor
    # grep '/usr/bin/factor' /var/db/pkg/*/*/CONTENTS
    /var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/bin/factor 5aaf903daa4345efb11618b3cb47e9a5 1224224574
    /var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/lib64/debug/usr/bin/factor.debug 517d965636850633e9b15926dde8c222 1224224575
    # cat /var/db/pkg/sys-apps/coreutils-6.12-r2/SRC_URI
    ftp://alpha.gnu.org/gnu/coreutils/coreutils-6.12.tar.lzma mirror://gnu/coreutils/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12-patches-1.0.tar.lzma http://dev.gentoo.org/~vapier/dist/coreutils-6.12-patches-1.0.tar.lzma
    # cat /var/db/pkg/sys-apps/coreutils-6.12-r2/HOMEPAGE
    http://www.gnu.org/software/coreutils/

But of course, the source code is probably still available in /usr/portage/distfiles .

但是,当然,源代码可能仍然可以在/ usr / portage / distfiles中使用。

#6


3  

Another, very good approach is to use Google Code Search. For example, a search for factor coreutils (see the man page or factor --help to see that it's from coreutils) came up with the package as the second result. Two clicks away I was browsing factor.c online.

另一种非常好的方法是使用Google Code Search。例如,搜索因子coreutils(参见手册页或因子 - 帮助看到它来自coreutils)得到了包作为第二个结果。两次点击,我在网上浏览factor.c。

Google Code Search searches most public source code. You can use regexps and many advanced search options, including restricting by language and license.

Google代码搜索会搜索大多数公共源代码。您可以使用regexp和许多高级搜索选项,包括按语言和许可限制。

#7


2  

I usually find a link to the source, homepage, and other useful information by doing a search on freshmeat.

我通常通过搜索freshmeat找到源,主页和其他有用信息的链接。

#8


-1  

You may want to check out SourceForge.net.

您可以查看SourceForge.net。

#1


9  

What I did was type

我做的是打字

man factor

and went to the bottom and found 'GNU coreutils 6.10'. So I googled 'coreutils' and... found the site joschi just linked to.

然后走到最底层,发现'GNU coreutils 6.10'。所以我用谷歌搜索'coreutils'并且......发现了joschi刚刚链接到的网站。

#2


14  

You can also find out which package the binary comes from an download that packages source code.

您还可以找到包含源代码的下载包含二进制文件的包。

On Debian (and Ubuntu and anything else that's based on Debian) you do that like this:

在Debian(以及Ubuntu和其他任何基于Debian的东西)上你这样做:

$ dpkg -S /usr/bin/factor
coreutils: /usr/bin/factor
$ apt-get source coreutils

The first command will check which package contains the file you are searching for (use "which factor" to find out which binary is executed when you just type "factor").

第一个命令将检查哪个包包含您要搜索的文件(使用“which factor”查找当您键入“factor”时执行的二进制文件)。

The second command will download and unpack the sources (including the patches applied to build the package) to the current directory, so it should be executed in a dedicated or temporary directory.

第二个命令将下载源代码(包括用于构建程序包的补丁程序包)并将其解压缩到当前目录,因此应该在专用或临时目录中执行。

I'm pretty sure rpm-based distributions have a similar mechanism, but I don't know their commands.

我很确定基于rpm的发行版有类似的机制,但我不知道它们的命令。

#3


5  

To find the package a binary comes from, in rpm based system, you might type:

要查找二进制文件包,在基于rpm的系统中,您可以键入:

$ rpm -qf /usr/bin/factor

which will print the package name. Instead, with:

这将打印包名称。相反,用:

$ rpm -qif /usr/bin/factor

you will get also information on a package, including it's home page in many cases.

您将获得有关包裹的信息,包括许多情况下的主页。

Source rpms also exist, but how to get them depends on the high-level package manager used on top of RPM (yum, urpmi, apt-get4 for rpm, ...).

源rpms也存在,但如何获取它们取决于在RPM之上使用的高级包管理器(yum,urpmi,apt-get4 for rpm,...)。

On most systems, also, /usr/share/doc/ contains some documentation on the program, and the website link is pretty often found somewhere there, maybe in the README.

在大多数系统上,/ usr / share / doc /还包含有关该程序的一些文档,并且网站链接经常在那里找到,可能在README中。

#4


4  

Usually you'll find the source code on the website of the program if it is open source. In this case here since factor is part of coreutils.

通常,如果它是开源的,你会在程序的网站上找到源代码。在这种情况下,因为因素是coreutils的一部分。

#5


3  

On Gentoo, simply look in the ebuild you compiled the package with :D.

在Gentoo上,只需查看编译包的ebuild:D。

If you're not sure?

如果你不确定?

    # which factor 
    /usr/bin/factor
    # grep '/usr/bin/factor' /var/db/pkg/*/*/CONTENTS
    /var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/bin/factor 5aaf903daa4345efb11618b3cb47e9a5 1224224574
    /var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/lib64/debug/usr/bin/factor.debug 517d965636850633e9b15926dde8c222 1224224575
    # cat /var/db/pkg/sys-apps/coreutils-6.12-r2/SRC_URI
    ftp://alpha.gnu.org/gnu/coreutils/coreutils-6.12.tar.lzma mirror://gnu/coreutils/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12-patches-1.0.tar.lzma http://dev.gentoo.org/~vapier/dist/coreutils-6.12-patches-1.0.tar.lzma
    # cat /var/db/pkg/sys-apps/coreutils-6.12-r2/HOMEPAGE
    http://www.gnu.org/software/coreutils/

But of course, the source code is probably still available in /usr/portage/distfiles .

但是,当然,源代码可能仍然可以在/ usr / portage / distfiles中使用。

#6


3  

Another, very good approach is to use Google Code Search. For example, a search for factor coreutils (see the man page or factor --help to see that it's from coreutils) came up with the package as the second result. Two clicks away I was browsing factor.c online.

另一种非常好的方法是使用Google Code Search。例如,搜索因子coreutils(参见手册页或因子 - 帮助看到它来自coreutils)得到了包作为第二个结果。两次点击,我在网上浏览factor.c。

Google Code Search searches most public source code. You can use regexps and many advanced search options, including restricting by language and license.

Google代码搜索会搜索大多数公共源代码。您可以使用regexp和许多高级搜索选项,包括按语言和许可限制。

#7


2  

I usually find a link to the source, homepage, and other useful information by doing a search on freshmeat.

我通常通过搜索freshmeat找到源,主页和其他有用信息的链接。

#8


-1  

You may want to check out SourceForge.net.

您可以查看SourceForge.net。