Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux latest

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
Perl Erlang PowerShell Julia Elixir Haskell Common Lisp Ruby Lua TypeScriptRustGoJavaC#C++Swift Kotlin Scala OCaml F# Clojure
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#

The tmux commands behind list_buffers.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

List the paste buffers

Equivalents of List the paste buffers in other languages
Language Equivalent
Ruby LibTmux::Server#list_buffers
Erlang tmux_buffer:list/1
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript server.Server.listBuffers
Rust server.Server.buffer_names
Go tmux.Server.ListBuffers
Java io.github.libtmux.Server.buffers
C# LibTmux.TmuxBuffers.GetAllAsync
C++ libtmux::Server::buffers
Swift Server.buffers()
OCaml No direct public OCaml equivalent is recorded for this operation.
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference