Skip to main content

Get the output from previous shell commands, if you use tmux

Project description

old-stdout

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

Get the old output from shell commands, if you use tmux.

This is vibe-coded but will become less so over time.

Motivation

It is quite natural to want to do thigns with the output of a command that you just run without having to rerun. If you have programmatic access to your shell scrollback, by using tmux this allows you to get output.

Alternatives and prior work

You could collect the outputs of previous commands into files using tee.

You could use something like jupyter which matains history.

Usage

Use tmux.

  • oldout will show the output of the previous command.
  • oldout 2 shows you the output from the penultimate command (etc).
  • outdiff shows the difference between the last two outputs

You can use --command with oldout to include the command.

Nonstandard prompts

I use a two line prompt. I therefore provide quite general features ot change the prompt parsing.

Multi-line Prompts

For prompts that span multiple lines, set PROMPT_LENGTH in ~/.config/oldout.py.

# Example two-line prompt:
# ┌─[user@host]─[/current/path]
# └─$ command here

PROMPT_RE = r"^┌─"  # Match the first line of the prompt
PROMPT_LENGTH = 2   # Skip both prompt lines when extracting output

Complex Prompt Patterns

The PROMPT_RE (in ~/.config/oldout.py.) regex can handle unusual prompt formats

# Powerline/fancy prompts with symbols
PROMPT_RE = r"➜\s+\w+"

# Prompts with timestamps
PROMPT_RE = r"^\[\d{2}:\d{2}:\d{2}\]"

# Conditional prompts (different in different directories)
PROMPT_RE = r"(prod|dev|staging)>"

# Prompts with color codes (matches after ANSI sequences)
PROMPT_RE = r"\x1b\[[0-9;]*m.*\$"

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools that are related to carrying out my work.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oldout-1.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oldout-1.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file oldout-1.1.0.tar.gz.

File metadata

  • Download URL: oldout-1.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for oldout-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fb5610e182448409760a83c66333f1adca22eba8d98e2fafaf7910c5aa50fcbf
MD5 188c2540f21b33004eddac9873f006c2
BLAKE2b-256 00688eb38e9fd4032f649bf23b1914c27d8e8123a0b8a78ed49139f39f6f28ba

See more details on using hashes here.

File details

Details for the file oldout-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: oldout-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for oldout-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79ea4165cd9ed1f1c025582b16db42f8b577e4d8229599277b6c959391963e2e
MD5 95e863b48dfdb454be9b04297fe5bbdd
BLAKE2b-256 747474d8fbdf4e06fa0a5c7c13a2b210fcaaceafed8bd957f1ec0169ec9af888

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page