Linux的man很强大,该手册分红不少section,使用man时能够指定不一样的section来浏览,各个section意义以下: html
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 - 其余linux
其中:
1是普通的命令
2是系统调用,如open,write之类的
3是库函数,如printf,fread
4是特殊文件,也就是/dev下的各类设备文件
5是指文件的格式,好比passwd, 就会说明这个文件中各个字段的含义
6是给游戏留的,由各个游戏本身定义
7是附件还有一些变量,好比向environ这种全局变量在这里就有说明
8是系统管理用的命令,这些命令只能由root使用,如ifconfiggit
使用手册方式举例:
man 1 ls #查看第一章中的ls命令帮助
man 3 printf #查看库函数printf帮助程序员
Set colors for man pages:github
设置方法比较简单,打开/etc/bash.bashrc(须要root权限)或者~/.bashrc文件加入以下内容:
windows
# 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的时候都是执行的该函数。bash
若是执行原始的man运行/usr/bin/man 便可。less
EG:函数
[root@server1 test1]# gunzip -c ifconfig.8.gz > ./ifconfig.man
[root@server1 test1]# man2html ifconfig.man >ifconfig.html工具
脚本:
从linux的man中提取html格式文件作成chm电子书 #!/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下可读的格式:
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内核维护者联系
一、README(http://lxr.linux.no/linux+v2.6.36/README),它的内容包括如下几部分:什么是Linux、运行的硬件环境、怎样安装和升级Linux内核源码、
编译Linux内核所须要的最小软件工具集合、怎样编译内核、怎样使用和引导新内核以及遇到问题时怎样处理等。
二、COPYING(http://lxr.linux.no/linux+v2.6.36/COPYING),这个是GNU协议GPL的详细说明。
三、CREDITS(http://lxr.linux.no/linux+v2.6.36/CREDITS),这个是对Linux内核有贡献的部分程序员列表。
四、REPORTING-BUGS(http://lxr.linux.no/linux+v2.6.36/REPORTING-BUGS),这个是提交BUG的规范。
第二部分:了解Linux内核源码自带文档Documentation的整体结构以及Linux内核的编码风格
五、Documentation(http://lxr.linux.no/linux+v2.6.36/Documentation/),这个文件夹里面包含的就是Linux内核具体的文档内容,其中有一些比较重要的文档。
六、Documentation/00-INDEX(http://lxr.linux.no/linux+v2.6.36/Documentation/00-INDEX),这个文档介绍了Documentation文件夹下各个文档的大体做用和内容。
七、Documentation/Changes(http://lxr.linux.no/linux+v2.6.36/Documentation/Changes),这个文档列出并介绍了运行Linux内核的最小工具软件集合。
八、Documentation/CodeStyle(http://lxr.linux.no/linux+v2.6.36/Documentation/CodingStyle),这个文档介绍了Linux内核的编码风格。
第三部分:开始学习Linux内核
九、Documentation/HOWTO(http://lxr.linux.no/linux+v2.6.36/Documentation/HOWTO),介绍了怎样成为一位内核开发人员。
十、Documentation/kernel-docs.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/kernel-docs.txt),开始学习Linux内核的你必定须要不少参考书籍,这个文档列出了不少学习Linux内核的优秀资源,包括不少著名书籍,例如:Linux Device Drivers等。
第四部分:Linux内核的具体模块的文档,这方面的文档能够根据本身的研究兴趣来查看,例如:Linux内核的启动代码文档、文件系统代码文档等。
十一、Documentation/x86/boot.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/x86/boot.txt),介绍了Linux内核启动时使用协议,内存结构图等。
十二、Documentation/filessystems/ext4.txt(http://lxr.linux.no/linux+v2.6.36/Documentation/filesystems/ext4.txt),介绍了ext4文件系统