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
相关推荐
菜菜的院子1 小时前
WSL2 运行 Ubuntu 26.04 完整 GNOME 桌面(WSLg Wayland)
linux·运维·ubuntu·wsl
KIDULT°3 小时前
Kubeadm 部署 Kubernetes v1.30.2 实战:Ubuntu24.04 三节点集群 + 排坑记录
ubuntu·云原生·容器·kubernetes·k8s
xiaobobo33304 小时前
man手册的格式、共性、命令
ubuntu·man手册结构·man手册共性·man手册命令
Happy_Sharing4 小时前
Windows虚拟机安装ubuntu后,如何在虚拟机Ubuntu系统中访问Windows文件夹
linux·运维·ubuntu
闲云自留地4 小时前
从零造一台 Ubuntu 24.04:虚拟机、装系统、配 IP 到 root 远程登录一篇通
数据库·tcp/ip·ubuntu
xiaobobo33305 小时前
Ubuntu 26.04环境下使用vim软件编辑文档的一些不常用用法
ubuntu·vim常用用法
我先去打把游戏先19 小时前
NimBLE是什么-ESP32蓝牙协议栈详解
单片机·嵌入式硬件·ubuntu
xiaobobo33301 天前
Ubuntu(26.04)最适合的简体拼音输入法以及相关安装教程
ubuntu·rime·fcitx5·最接近搜狗输入的输入法
闲云野鹤在人间1 天前
Ubuntu 24.04 安装过程
服务器·数据库·ubuntu