Linux apropos 命令使用详解

简介

apropos 是一个模糊搜索工具,可以在所有 man 页面里搜输入的关键词。相比 whatis 只能搜命令名,apropos 描述内容也能搜。

常用选项

  • -e, --exact:返回与关键字完全匹配的名称和描述

  • -d:打印调试消息

  • -w, --wildcard:使用通配符搜索关键字

  • -a, --and:功能类似于逻辑与。当所有关键字匹配时返回输出

  • -l, --long:输出不截断

  • -C:使用用户配置文件而不是 $MANPATH

  • -s:仅在特定的手册页部分中搜索。

  • -M:将搜索路径设置为 PATH 而不是默认的 $MANPATH

  • -L:设置搜索的区域设置

  • -r, --regex:将每个关键字解释为正则表达式

  • -d:打印 debug 信息

  • -v:打印详细的警告信息

示例用法

基本用法

shell 复制代码
apropos "list"

**示例输出

shell 复制代码
ls (1)               - list directory contents
dir (1)              - list directory contents
nmcli (1)            - command-line tool for controlling NetworkManager

搜索多个词(默认是或关系)

shell 复制代码
apropos "list copy"

搜索多个词,逻辑与匹配

shell 复制代码
apropos -a list directory

精准匹配

shell 复制代码
apropos -e set

搜索指定章节的

在第 1 节和第 8 节中搜索

shell 复制代码
apropos -s 1,8 list

使用正则表达式搜索

查找以单词 list 开头的所有手册页

shell 复制代码
apropos '^list'

正则表达式实现或的关系

shell 复制代码
apropos "zip(note|cloak|info)"

多种选项结合

shell 复制代码
apropos -a -s 3,8 "^list" "(implementation|devices|users)"

避免截断

默认会修剪输出中的描述,输出以省略号结尾

shell 复制代码
apropos -l list

whatis vs apropos

功能 whatis apropos
搜命令名 ✅ ✅
搜描述内容 ❌ ✅
匹配模糊内容 ❌ ✅
精准 ✅ ❌
相关推荐
Apipi*1 小时前
30天速通Linux 第六章信号及信号处理
linux·运维·信号处理
天启HTTP2 小时前
爬虫防封核心原理:IP轮换机制与风控规避逻辑
linux·服务器·网络·爬虫·tcp/ip
广州浮点FLOATLIC4 小时前
许可证服务器迁移后软件打不开:研发 IT 怎样定位连接问题
linux·服务器·数据库
BLUcoding5 小时前
接口服务公网超时排查记录:SecureRandom 阻塞问题分析与解决
java·linux·springboot·aes·securerandom
AIgorithmGEEK5 小时前
[Linux]从手写报头到内核套路:序列化、反序列化与自定义协议全链路
linux·运维·服务器·网络·序列化·反序列化
Nil2085 小时前
leetcode 139单词拆分
linux·运维·服务器
Starry-sky(jing)5 小时前
BUG: unable to handle kernel paging request 完整排查:dmesg 四要素与三路定罪
linux·运维·服务器·内核·排障
mounter6255 小时前
从硬件互连到操作系统变革:CXL 技术演进与 Linux 内核工程挑战
linux·运维·服务器
xh didida7 小时前
Linux -- 基础IO
linux·服务器·开发语言·c++
zly35007 小时前
centos7 mount设备挂载 /dev/sda1/硬盘挂载
linux·运维·服务器