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


使用方法

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

使用方法:

man command

示例:

[root@VM_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、獲取安裝包

[root@localhost 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、解壓並安裝

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

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

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

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

[root@localhost ~]# cman ls

執行結果:

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM