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)

[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

执行结果:

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

©️2020 CSDN 皮肤主题: 撸撸猫 设计师:设计师小姐姐 返回首页