Ubuntu 26.04环境中如何使用中文man手册以及man手册默认中文显示

最近,我在使用Ubuntu 26.04的环境,经常使用命令行的方式操作一些不常用的系统自带软件例如,mkdir、lsblk、df等等,现在就有一个问题,Ubuntu 26.04自带的man手册是英文的看起来不方便,有没有更好的呢?例如中文man手册。

我问了一下AI,并操作了一下,发现的确可行,现在记录下来。

第一步:

安装中文 man 手册

bash 复制代码
sudo apt update
sudo apt install manpages-zh

第二步:

推荐用法:保留英文 man,新增 cman

bash 复制代码
nano ~/.bashrc

在默认新增:

bash 复制代码
alias cman='man -M /usr/share/man/zh_CN'

第三步:生效配置:

bash 复制代码
source ~/.bashrc

之后:

bash 复制代码
cman ls
cman fdisk

不过值得注意的是cman手册的内容不全,并不是所有命令的中文man手册解释都有的。

如果想让 man 默认显示中文(我尝试了一下,可行)

可以在 ~/.bashrc 里加:

bash 复制代码
export LANG=zh_CN.UTF-8

然后,使配置生效:

bash 复制代码
source ~/.bashrc

引伸:

man手册内容比较多,有一种比较简查询命令"cheat"便的,具体安装方式如下:需要用到snap命令。这也是为什么查询apt-get 以及dpkg命令无法找到原因。

bash 复制代码
apt list --installed
# 或者
apt-mark showmannul
# 或者
dpkg -l

安装方式:

bash 复制代码
snap install cheat

使用方式:

bash 复制代码
cheat ls
# 显示如下:
# To display everything in <dir>, excluding hidden files:
ls <dir>

# To display everything in <dir>, including hidden files:
ls -a <dir>

# To display all files, along with the size (with unit suffixes) and timestamp:
ls -lh <dir>

# To display files, sorted by size:
ls -S <dir>

# To display directories only:
ls -d */ <dir>

# To display directories only, include hidden:
ls -d .*/ */ <dir>

# To display all files sorted by changed date, most recent first:
ls -ltc 

# To display files sorted by create time:
ls -lt

# To display files in a single column:
ls -1

# To show ACLs (MacOS):
# see also `cheat chmod` for `/bin/chmod` options for ACLs
/bin/ls -le

# To show all the subtree files (Recursive Mode):
ls -R
相关推荐
木子欢儿2 天前
Ubuntu 26.04 LTS 安装Python 3.12
linux·运维·服务器·python·ubuntu
2601_967979124 天前
Ubuntu部署tensorflow(CPU/GPU)方法
ubuntu·tensorflow·cpu·gpu·配置
Rabitebla4 天前
【Linux】文件篇(五):手撕简易 FILE——模拟实现 C 标准 I/O 缓冲机制
linux·服务器·c语言·笔记·学习·ubuntu
江湖有缘11 天前
基于Ubuntu部署SoduWork:企业级 AI 原生协同平台实战全流程
linux·人工智能·ubuntu·ai·soduwork
瓦瓦gogo13 天前
从一个 TypeScript 函数开始理解 MCP 协议
linux·ubuntu·typescript
鱼听禅13 天前
Ubuntu安装YOLOv8进行菌落识别训练
linux·python·yolo·ubuntu
Zucker n14 天前
文献发现、课题组织与证据可追溯的论文阅读。
论文阅读·windows·ubuntu
qq_3718021117 天前
Ubuntu Linux中安装WorkBuddy
linux·运维·服务器·ubuntu
且从容.18 天前
Ubuntu安装flume
linux·ubuntu·flume
承渊政道18 天前
Linux网络学习【Reactor反应堆模式】
linux·网络·学习·ubuntu·reactor