LINUX 内核文档地址

 

Linux的man很强大,该手册分成很多section,使用man时可以指定不同的section来浏览,各个section意义如下: 

1 - commands
2 - system calls
3 - library calls
4 - special files
5 - file formats and convertions
6 - games for linux
7 - macro packages and conventions
8 - system management commands
9 - 其他


其中:
1是普通的命令
2是系统调用,如open,write之类的
3是库函数,如printf,fread
4是特殊文件,也就是/dev下的各种设备文件
5是指文件的格式,比如passwd, 就会说明这个文件中各个字段的含义
6是给游戏留的,由各个游戏自己定义
7是附件还有一些变量,比如向environ这种全局变量在这里就有说明
8是系统管理用的命令,这些命令只能由root使用,如ifconfig

使用手册方式举例:
man 1 ls         #查看第一章中的ls命令帮助
man 3 printf     #查看库函数printf帮助

 

 

 

Set colors for man pages:

 

设置方法比较简单,打开/etc/bash.bashrc(需要root权限)或者~/.bashrc文件加入如下内容:
 

# Set colors for man pages
man() {
env \
LESS_TERMCAP_mb=$(printf “\e[1;31m”) \
LESS_TERMCAP_md=$(printf “\e[1;31m”) \
LESS_TERMCAP_me=$(printf “\e[0m”) \
LESS_TERMCAP_se=$(printf “\e[0m”) \
LESS_TERMCAP_so=$(printf “\e[1;44;33m”) \
LESS_TERMCAP_ue=$(printf “\e[0m”) \
LESS_TERMCAP_us=$(printf “\e[1;32m”) \
man “$@”
}

重新打开终端,现在执行man就有颜色了。

该脚本其实定义了一个man函数,每次我们执行man的时候都是执行的该函数。

如果执行原始的man运行/usr/bin/man 即可。

 

   EG:

[root@server1 test1]# gunzip -c ifconfig.8.gz > ./ifconfig.man
[root@server1 test1]# man2html ifconfig.man >ifconfig.html


#!/bin/bash

#This is a manual transform script

#it will transform all manuals to htmls


MAN2HTML=/usr/bin/man2html
MANPATH=/home/tt/man/man
GZ=/bin/gzip
TargetHtmlPath=/home/tt/pp

NUM=9
function createhtml()
{
    for (( i=1; i<=NUM; i++ ));
    do
        dir="${MANPATH}${i}"    ##get target path

        if [ -d $dir ]
        then
        (
        cd $dir 
        ${GZ} -dvf *.gz && ${MAN2HTML} ".*${i}" 
        for file in *
        do
            if [ -f $file ]
            then
            ${MAN2HTML} $file >"${file}.html"
            fi
        done 
        )
        fi

        
        dir2="${MANPATH}${i}p"    ##get target path

        if [ -d $dir2 ]
        then
        echo $dir2
        (
        cd $dir2 && ${GZ} -dvf *.gz && ${MAN2HTML} ".*${i}" 
        for file in *
        do
            if [ -f $file ]
            then
            ${MAN2HTML} $file >"${file}.html"
            fi
        done 
        )
        fi    
    done
}


function copyhtml()
{
    for (( i=1; i<=NUM; i++ ));
    do
        dir="${MANPATH}${i}"    ##get target path

        if [ -d $dir ]
        then
        (
        cd $dir 
        pwd
        #cp *.html ${TargetHtmlPath} -v

        for file in *.html
        do
            cp ${file} ${TargetHtmlPath} -v
        done
        )
        fi
            
        dir2="${MANPATH}${i}p"    ##get target path

        if [ -d dir2 ];
        then
        (
        cd $dir2 
        pwd
        #cp *.html ${TargetHtmlPath} -v

        for file in *.html
        do
            cp ${file} ${TargetHtmlPath} -v
        done
        )
        fi
    done
}

#createhtml

copyhtml

 

 

 

 

把linux的man手册转化为windows下可读的格式:

 
man ls >ls.txt
但是从Linux系统里传到windows里无法正常查看。
解决方法:
man ls | col -b >ls.txt

格式:man command_name | col -b >command_name.txt

感觉不方便也可以制作成pdf电子书

格式如下:man -t command_name | ps2pdf ->command_name.pdf

 

 

 

 http://www.dit.upm.es/~jmseyas/linux/kernel/hackers-docs.html   online document book about linux kernerl

 

https://lwn.net/Articles/648154/     :Adding Processor Trace support to Linux

 

http://halobates.de/blog/  

 

http://kernelplanet.org/   LINUX 内核站点

 

https://www.kernel.org/doc/  LINUX 内核文档

 

https://github.com/tinyclub/linux-doc

 

 

Linux内核源码自带了很多很优秀的文档信息,那么这些文档的大概阅读顺序是什么呢?

http://lxr.linux.no/linux+v2.6.36/是一个在线阅读Linux内核源码的好地方)

第一部分:学会安装使用Linux内核、GPL规范和怎样与Linux内核维护者联系

1、README(http://lxr.linux.no/linux+v2.6.36/README),它的内容包括以下几部分:什么是Linux、运行的硬件环境、怎样安装和升级Linux内核源码、

编译Linux内核所需要的最小软件工具集合、怎样编译内核、怎样使用和引导新内核以及遇到问题时怎样处理等。

2、COPYING(http://lxr.linux.no/linux+v2.6.36/COPYING),这个是GNU协议GPL的详细说明。

3、CREDITS(http://lxr.linux.no/linux+v2.6.36/CREDITS),这个是对Linux内核有贡献的部分程序员列表。

4、REPORTING-BUGS(http://lxr.linux.no/linux+v2.6.36/REPORTING-BUGS),这个是提交BUG的规范。

第二部分:了解Linux内核源码自带文档Documentation的总体结构以及Linux内核的编码风格

5、Documentation(http://lxr.linux.no/linux+v2.6.36/Documentation/),这个文件夹里面包含的就是Linux内核具体的文档内容,其中有一些比较重要的文档。

6、Documentation/00-INDEX(http://lxr.linux.no/linux+v2.6.36/Documentation/00-INDEX),这个文档介绍了Documentation文件夹下各个文档的大致作用和内容。

7、Documentation/Changes(http://lxr.linux.no/linux+v2.6.36/Documentation/Changes),这个文档列出并介绍了运行Linux内核的最小工具软件集合。

8、Documentation/CodeStyle(http://lxr.linux.no/linux+v2.6.36/Documentation/CodingStyle),这个文档介绍了Linux内核的编码风格。

第三部分:开始学习Linux内核

9、Documentation/HOWTO(http://lxr.linux.no/linux+v2.6.36/Documentation/HOWTO),介绍了怎样成为一位内核开发人员。

10、Documentation/kernel-docs.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/kernel-docs.txt),开始学习Linux内核的你一定需要很多参考书籍,这个文档列出了很多学习Linux内核的优秀资源,包括很多著名书籍,例如:Linux Device Drivers等。

第四部分:Linux内核的具体模块的文档,这方面的文档可以根据自己的研究兴趣来查看,例如:Linux内核的启动代码文档、文件系统代码文档等。

11、Documentation/x86/boot.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/x86/boot.txt),介绍了Linux内核启动时使用协议,内存结构图等。

12、Documentation/filessystems/ext4.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/filesystems/ext4.txt),介绍了ext4文件系统

相关文章:

  • 2021-08-17
  • 2021-08-15
  • 2022-01-20
  • 2021-04-23
  • 2021-12-22
  • 2019-12-12
  • 2022-02-12
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-05-19
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-07-25
相关资源
相似解决方案