Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Python API

method libtmux stable

Server.list_buffers

List paste buffers via $ tmux list-buffers.

Source and package
Qualified name
libtmux.Server.list_buffers
Module
libtmux
Declared in
Server
Package
libtmux
Source
src/libtmux/server.py
Other languages
PowerShell Julia Ruby Lua TypeScriptRustGoJavaC#C++Swift Kotlin Scala F#
list_buffers ( self, format_string: str | None = None, filter: str | None = None, # noqa: A002, ) → list[str]

Description#

Without arguments returns tmux's default template (name: N bytes: "sample") — kept for backward compatibility. Pass format_string to request a specific tmux format, or filter to have tmux return only matching buffers.

Examples#

Default template (backward-compatible):

>>> server.set_buffer('buf_data')
>>> result = server.list_buffers()
>>> len(result) >= 1
True

Project just the names:

>>> server.set_buffer('hello', buffer_name='gap6_demo')
>>> 'gap6_demo' in server.list_buffers(format_string='#{buffer_name}')
True

Filter via tmux:

>>> matches = server.list_buffers(
... format_string='#{buffer_name}',
... filter='#{m:gap6_*,#{buffer_name}}',
... )
>>> 'gap6_demo' in matches
True
Parameters
  • format_string (str | None) # – Output template (-F flag). Example: "#{buffer_name}" for raw names only. added 0.57

  • filter (str | None) # – Filter expression evaluated by tmux (-f flag). Buffers for which the expanded expression is false are omitted. Example: "#{m:libtmux_mcp_*,#{buffer_name}}". Note: this kwarg shadows the Python builtin filter by design — it mirrors tmux's own flag name (-f filter) for grep-friendly symmetry between the wrapper and the tmux manual. tmux silently expands a malformed filter (unclosed #{...}, unknown format token) to empty, which the filter treats as false — every row is suppressed and no stderr is emitted. A bad filter is indistinguishable from "filter matched nothing"; verify filter syntax against the FORMATS section of tmux(1). Warning: added 0.57

  • # noqa: A002 #

Returns

list[str] Raw output lines.

tmux command list-buffers

In other ports List the paste buffers
Esc

Type to search.

Reference preview Open reference