我想知道是否有办法将手册页打开到特定的搜索字符串,而不是man chmod
然后/a+x
跳到chmod手册页的第一部分a+x
,类似于vi +string filename.txt
在vi(m )。
我想知道是否有办法将手册页打开到特定的搜索字符串,而不是man chmod
然后/a+x
跳到chmod手册页的第一部分a+x
,类似于vi +string filename.txt
在vi(m )。
Answers:
-p
开关避免了需要相当难看+/
...
less
(和大多数寻呼机)的行为就像cat
输出不是终端一样。
less
已经是您的手册页,您也可以通过运行进行优化LESS=+/searched_string man foobar
。这也有工作的优势man -a
据我所知(但@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