1. 程式人生 > >Linux之man命令詳解及中文漢化

Linux之man命令詳解及中文漢化

使用方法

Linux man中的man就是manual的縮寫,用來檢視系統中自帶的各種參考手冊

使用方法:

man command

示例:

[[email protected]_0_13_centos ~]# man ls
LS(1)                                                                                  User Commands                                                                                 LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

       Mandatory arguments to long options are mandatory for short options too.

       -a, --all
              do not ignore entries starting with .

       -A, --almost-all
              do not list implied . and ..

       --author
              with -l, print the author of each file

       -b, --escape
              print C-style escapes for nongraphic characters

       --block-size=SIZE
              scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see SIZE format below

       -B, --ignore-backups
              do not list implied entries ending with ~

       -c     with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first

常用引數:

大寫N:向上查詢
小寫n:向下查詢
/或?:查詢內容
q:退出

也可以使用以下命令更詳細

info command

安裝中文版man

英文不好?沒關係,往下看!!!

原官方下載地址

Githu專案地址

安裝方法一

1、Debian / Ubuntu安裝

sudo apt update
sudo apt install manpages-zh

2、Arch Linux:

pacman -Syu
pacman -S man-pages-zh_cn man-pages-zh_tw

3、Red Hat / CentOS:

yum update
yum install man-pages-zh-CN

4、Fedora:

dnf update
dnf install man-pages-zh-CN

安裝方法二

原始碼網址 https://src.fedoraproject.org/repo/pkgs/man-pages-zh-CN/

1、獲取安裝包

[[email protected] opt]# wget  https://src.fedoraproject.org/repo/pkgs/man-pages-zh-CN/manpages-zh-1.5.1.tar.gz/13275fd039de8788b15151c896150bc4/manpages-zh-1.5.1.tar.gz

2、解壓並安裝

[[email protected] opt]# tar xf manpages-zh-1.5.1.tar.gz
[[email protected] opt]# cd manpages-zh-1.5.1/
[[email protected] manpages-zh-1.5.1]# ./configure --disable-zhtw  --prefix=/usr/local/zhman
[[email protected] manpages-zh-1.5.1]# make && make install

3、 為了不覆蓋man,我們新建cman命令作為中文查詢

[[email protected] man1]# cd ~
[[email protected] ~]# echo "alias cman='man -M /usr/local/zhman/share/man/zh_CN' " >>.bash_profile
[[email protected] ~]# source .bash_profile

4.使用我們新建的中文cman查詢命令

[[email protected] ~]# cman ls

執行結果:

到此就完成了常用的命令都可以