Instead of doing
man chmod and then
/a+x to jump to the first section in the chmod man page that mentions
a+x, I would like to know if there is a way to open the man page to a specific search string, similar to how you can do
vi +string filename.txt in vi(m).
Try this trick:
man chmod | less +'/a\+x'
man chmod | more +'/a\+x'
With a backslash before the
+ sign because what comes after
/ is an extended regular expression.
Not as far as I know (but as @sputnick points out, I don't know much), but you can parse it:
man chmod | grep -C 5 'a+x'
I would recommend using a string that actually exists in the man page though, something like:
$ 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