iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📓

How to Copy or Search Man Pages on macOS

に公開

macOS provides a command called pbcopy that allows you to save standard input to the macOS clipboard directly from the terminal.
This means you can copy the help page of any command using the following:

man tmux | pbcopy

👇 Displays it normally:

man tmux | cat

You can also search through it using ripgrep (a Rust version of grep):

man tmux | rg "kill"

     in the same session.  Once all sessions are killed, tmux exits.
           kill-session
           $ tmux kill-window -t :1
             specified by -s.  The -a option kills all but the client given
             -a is given, all sessions but the specified one is killed.  The
             killed without affecting the others.  The group-name argument may
             window, it is also destroyed.  The -a option kills all but the
             it from any sessions to which it is linked.  The -a option kills
             necessary).  If -k is given and dst-window exists, it is killed,
             in which case any existing command is killed.  -c specifies a new
             given, in which case any existing command is killed.  -c
             The client was killed with SIGTERM.

For commands like tmux that don't have a --help flag and only provide help via man, using pipes is a great way to change how you view or process that information. Pipes are incredibly powerful.

Discussion