![打开手册页并在单个命令中搜索字符串](https://linux22.com/image/3471/%E6%89%93%E5%BC%80%E6%89%8B%E5%86%8C%E9%A1%B5%E5%B9%B6%E5%9C%A8%E5%8D%95%E4%B8%AA%E5%91%BD%E4%BB%A4%E4%B8%AD%E6%90%9C%E7%B4%A2%E5%AD%97%E7%AC%A6%E4%B8%B2.png)
我想知道是否有一种方法可以打开特定搜索字符串的手册页,而不是跳转到 chmod 手册页中提到的第一部分,类似于man chmod
在vi /a+x
( m )。a+x
vi +string filename.txt
答案1
答案2
据我所知不是(但@sputnick点出来,我知道的不多),但你可以解析它:
man chmod | grep -C 5 'a+x'
我建议使用手册页中实际存在的字符串,例如:
$ man chmod | grep -C 5 set-user-ID
traversals.
SETUID AND SETGID BITS
chmod clears the set-group-ID bit of a regular file if the file's group ID does not match the
user's effective group ID or one of the user's supplementary group IDs, unless the user has appro‐
priate privileges. Additional restrictions may cause the set-user-ID and set-group-ID bits of
MODE or RFILE to be ignored. This behavior depends on the policy and functionality of the under‐
lying chmod system call. When in doubt, check the underlying system behavior.
chmod preserves a directory's set-user-ID and set-group-ID bits unless you explicitly specify oth‐
erwise. You can set or clear the bits with symbolic modes like u+s and g-s, and you can set (but
not clear) the bits with a numeric mode.
RESTRICTED DELETION FLAG OR STICKY BIT
The restricted deletion flag or sticky bit is a single bit, whose interpretation depends on the
答案3
假设您用作less
寻呼机(这是现代系统上的默认设置),请将搜索指令添加到环境变量中LESS
。这是 的命令行选项列表less
。您可以/
通过在命令前面加上前缀来传递要执行的 less 命令,例如进行搜索+
(就像使用 vi 一样)。
LESS="$LESS +/a\+x" man chmod
这样做的优点man chmod | less "+/a\+x"
是不会丢失格式。
也可以看看zmv for zsh:试运行和手册页