Skip to content

wezterm cli get-text

Since: Version 20230320-124340-559cb7b0

The functionality described in this section requires version 20230320-124340-559cb7b0 of wezterm, or a more recent version.

Run wezterm cli get-text --help to see more help

Retrieves the textual content of a pane and output it to stdout.

For example:

$ wezterm cli get-text > /tmp/myscreen.txt

will capture the main (non-scrollback) portion of the current pane to /tmp/myscreen.txt.

By default, just the raw text is captured without any color or styling escape sequences. You may pass --escapes to include those:

$ wezterm cli get-text --escapes > /tmp/myscreen-with-colors.txt

The default capture region is the main terminal screen, not including the scrollback. You may use the --start-line and --end-line parameters to set the range. Both of these accept integer values, where 0 refers to the top of the non-scrollback screen area, and negative numbers index backwards into the scrollback.

Synopsis

Retrieves the textual content of a pane and output it to stdout

Usage: wezterm cli get-text [OPTIONS]

Options:
      --pane-id <PANE_ID>
          Specify the target pane. The default is to use the current pane based
          on the environment variable WEZTERM_PANE
      --start-line <START_LINE>
          The starting line number. 0 is the first line of terminal screen.
          Negative numbers proceed backwards into the scrollback. The default
          value is unspecified is 0, the first line of the terminal screen
      --end-line <END_LINE>
          The ending line number. 0 is the first line of terminal screen.
          Negative numbers proceed backwards into the scrollback. The default
          value if unspecified is the bottom of the the terminal screen
      --escapes
          Include escape sequences that color and style the text. If omitted,
          unattributed text will be returned
  -h, --help
          Print help