看Linux代码,最好结合Linux内核开发文档。Linux内核开发文档在https://www.kernel.org/ ,访问速度慢。一般开发,也只需要某一个版本的文档。这时,执行下列命令,可以下载Linux内核开发文档到本地查看,保证速度飞快。下列命令中,我指定了Linux内核版本4.19。
nohup wget -c -r -np -k -L -p https://www.kernel.org/doc/html/v4.19/
下载时,会有类似下列的信息输出。
--2020-03-05 15:31:30-- https://www.kernel.org/doc/html/v4.19/
Resolving www.kernel.org (www.kernel.org)... 147.75.46.191, 2604:1380:4080:c00::1
Connecting to www.kernel.org (www.kernel.org)|147.75.46.191|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 42864 (42K) [text/html]
Saving to: ‘www.kernel.org/doc/html/v4.19/index.html’
0K .......... .......... .......... .......... . 100% 2.06M=0.02s
2020-03-05 15:31:31 (2.06 MB/s) - ‘www.kernel.org/doc/html/v4.19/index.html’ saved [42864/42864]
... ... ... ...
Converting links in www.kernel.org/doc/html/v4.19/_static/theme_overrides.css... nothing to do.
Converting links in www.kernel.org/doc/html/v4.19/_static/css/theme.css... 11-1
Converted links in 953 files in 1.0 seconds.
下载后,得到1949个文件,大约45.7 MB 。在本地目录 www.kernel.orgdochtmlv4.19 里找到index.html,是整个文档的入口,双击打开,就得到和在网站 https://www.kernel.org/ 一样的内容。注意, www.kernel.org 是本地目录的名称。