默认在当前目录生成 out.png,需用 --filename 指定其他路径;含管道的命令要整体用双引号包裹,否则解析有歧义;部分 ANSI 序列(如重置光标位置)尚不能正确解析,截图可能失真
brew install homeport/tap/termshot
termshot ls -aREADME 未说明,仅提供 macOS/Linux 的 Homebrew 安装与 Darwin、Linux 预编译二进制
把终端命令输出连同 ANSI 颜色渲染成窗口样式截图的命令行工具
把终端命令输出直接渲染成带 ANSI 配色的截图,省去手动截屏和排版,适合写文档或发 issue 时贴命令行结果。
核心能力
- 解析命令输出的 ANSI 转义码,保留真实配色
- 像 time 一样前缀调用,自动生成 out.png
- 支持 --show-cmd 在图中显示所执行的命令
- 可调列宽、边距、内边距、阴影与窗口装饰
- 支持 --edit 先编辑输出再截图,便于去掉敏感内容
容易踩的坑
- v0.6.1termshot release v0.6.1最新正式版2026-02-09 · 2026-02-09 11:49 UTC
What's Changed
- Bump golang.org/x/sys from 0.33.0 to 0.34.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/328
- Bump golang.org/x/term from 0.32.0 to 0.33.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/329
- Bump golang.org/x/text from 0.26.0 to 0.27.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/331
- Bump golang.org/x/image from 0.28.0 to 0.29.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/330
- Bump golang.org/x/net from 0.41.0 to 0.42.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/332
- Update termshot examples by @HeavyWombat in https://github.com/homeport/termshot/pull/327
- Bump github.com/spf13/pflag from 1.0.6 to 1.0.7 by @dependabot[bot] in https://github.com/homeport/termshot/pull/334
- Bump github.com/onsi/gomega from 1.37.0 to 1.38.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/335
- Bump golang.org/x/tools from 0.34.0 to 0.35.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/333
- Bump golang.org/x/sys from 0.34.0 to 0.35.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/336
- Bump golang.org/x/term from 0.33.0 to 0.34.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/337
- Bump golang.org/x/net from 0.42.0 to 0.43.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/340
- Bump golang.org/x/text from 0.27.0 to 0.28.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/341
- Bump golang.org/x/image from 0.29.0 to 0.30.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/338
- Bump golang.org/x/tools from 0.35.0 to 0.36.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/339
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in https://github.com/homeport/termshot/pull/342
- Bump github.com/onsi/ginkgo/v2 from 2.23.4 to 2.24.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/343
- Bump github.com/Masterminds/semver/v3 from 3.3.1 to 3.4.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/344
- Bump github.com/onsi/ginkgo/v2 from 2.24.0 to 2.25.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/345
- Bump github.com/onsi/ginkgo/v2 from 2.25.0 to 2.25.1 by @dependabot[bot] in https://github.com/homeport/termshot/pull/346
- Bump github.com/onsi/gomega from 1.38.0 to 1.38.1 by @dependabot[bot] in https://github.com/homeport/termshot/pull/347
- Bump github.com/onsi/gomega from 1.38.1 to 1.38.2 by @dependabot[bot] in https://github.com/homeport/termshot/pull/348
- Bump github.com/onsi/ginkgo/v2 from 2.25.1 to 2.25.2 by @dependabot[bot] in https://github.com/homeport/termshot/pull/349
- Bump github.com/spf13/pflag from 1.0.7 to 1.0.9 by @dependabot[bot] in https://github.com/homeport/termshot/pull/350
- Bump github.com/spf13/pflag from 1.0.9 to 1.0.10 by @dependabot[bot] in https://github.com/homeport/termshot/pull/352
- Bump github.com/spf13/cobra from 1.9.1 to 1.10.1 by @dependabot[bot] in https://github.com/homeport/termshot/pull/351
- Bump github.com/onsi/ginkgo/v2 from 2.25.2 to 2.25.3 by @dependabot[bot] in https://github.com/homeport/termshot/pull/353
- Bump golang.org/x/sys from 0.35.0 to 0.36.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/355
- Bump golang.org/x/text from 0.28.0 to 0.29.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/354
- Bump golang.org/x/term from 0.34.0 to 0.35.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/356
- Bump actions/setup-go from 5 to 6 by @dependabot[bot] in https://github.com/homeport/termshot/pull/357
- Bump github.com/lucasb-eyer/go-colorful from 1.2.0 to 1.3.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/358
- Bump golang.org/x/net from 0.43.0 to 0.44.0 by @dependabot[bot] in https://github.com/homeport/termshot/pull/359
- Bump golang.org/x/image from 0.30.0 to 0.31.0 by @dependabot[bot] in https://github.com/homeport/termsh
- v0.6.0termshot release v0.6.02025-06-28 · 2025-06-28 16:57 UTC
查看更新说明
What's Changed
- Bump golangci/golangci-lint-action from 7 to 8 by @dependabot in https://github.com/homeport/termshot/pull/310
- Bump golang.org/x/sys from 0.32.0 to 0.33.0 by @dependabot in https://github.com/homeport/termshot/pull/311
- Bump golang.org/x/text from 0.24.0 to 0.25.0 by @dependabot in https://github.com/homeport/termshot/pull/312
- Bump golang.org/x/image from 0.26.0 to 0.27.0 by @dependabot in https://github.com/homeport/termshot/pull/316
- Bump golang.org/x/term from 0.31.0 to 0.32.0 by @dependabot in https://github.com/homeport/termshot/pull/315
- Bump golang.org/x/net from 0.39.0 to 0.40.0 by @dependabot in https://github.com/homeport/termshot/pull/314
- Bump golang.org/x/tools from 0.32.0 to 0.33.0 by @dependabot in https://github.com/homeport/termshot/pull/313
- Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in https://github.com/homeport/termshot/pull/317
- Bump golang.org/x/tools from 0.33.0 to 0.34.0 by @dependabot in https://github.com/homeport/termshot/pull/319
- Bump golang.org/x/image from 0.27.0 to 0.28.0 by @dependabot in https://github.com/homeport/termshot/pull/321
- Bump Go minimum version and available modules by @HeavyWombat in https://github.com/homeport/termshot/pull/324
- Bump github.com/gonvenience/bunt from 1.4.1 to 1.4.2 by @dependabot in https://github.com/homeport/termshot/pull/325
Full Changelog: https://github.com/homeport/termshot/compare/v0.5.0...v0.6.0
- v0.5.0termshot release v0.5.02025-04-08 · 2025-04-08 21:18 UTC
查看更新说明
What's Changed
- Add flags to write and read raw content by @HeavyWombat in https://github.com/homeport/termshot/pull/299
- Use
scaffold.WritePNGinstead ofscaffold.Writeby @HeavyWombat in https://github.com/homeport/termshot/pull/307 - Bump to
golangci-lintconfig version 2 by @HeavyWombat in https://github.com/homeport/termshot/pull/308
Full Changelog: https://github.com/homeport/termshot/compare/v0.4.1...v0.5.0
- v0.4.1termshot release v0.4.12025-01-05 · 2025-01-05 12:39 UTC
查看更新说明
Fixes
- #220
- #102
What's Changed
- Bump golang.org/x/term from 0.27.0 to 0.28.0 by @dependabot in https://github.com/homeport/termshot/pull/261
- Bump github.com/onsi/ginkgo/v2 from 2.22.1 to 2.22.2 by @dependabot in https://github.com/homeport/termshot/pull/260
- Bump github.com/gonvenience/bunt from 1.3.5 to 1.4.0 by @dependabot in https://github.com/homeport/termshot/pull/262
Full Changelog: https://github.com/homeport/termshot/compare/v0.4.0...v0.4.1
- v0.4.0termshot release v0.4.02025-01-02 · 2025-01-02 21:32 UTC
查看更新说明
What's Changed
- Refactor
fontpackage by @HeavyWombat in https://github.com/homeport/termshot/pull/251 - Switch to
fontpackage by @HeavyWombat in https://github.com/homeport/termshot/pull/252 - Add clip canvas option by @HeavyWombat in https://github.com/homeport/termshot/pull/253
- Address
gosecfindings by @HeavyWombat in https://github.com/homeport/termshot/pull/255 - Remove context error from
wrappackage by @HeavyWombat in https://github.com/homeport/termshot/pull/256 - Tweak GitHub Action setup by @HeavyWombat in https://github.com/homeport/termshot/pull/257
- Refactor show command code logic by @HeavyWombat in https://github.com/homeport/termshot/pull/258
- Start pseudo terminal with explicit window size by @HeavyWombat in https://github.com/homeport/termshot/pull/259
Full Changelog: https://github.com/homeport/termshot/compare/v0.3.0...v0.4.0
- Refactor
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
termshot
Generate beautiful screenshots of your terminal, from your terminal.
termshot lolcat -f <(figlet -f big termshot)
This command generates this screenshot:

Installation
To install with Homebrew on macOS or Linux:
brew install homeport/tap/termshot
See Releases for pre-compiled binaries for Darwin and Linux.
Usage
This tool reads the console output and renders an output image that resembles a user interface window. It's inspired by some other web-based tools like carbon.now.sh, and codekeep.io/screenshot. Unlike those tools, termshot does not blindly apply syntax highlighting to some provided text; instead it reads the ANSI escape codes ("rich text") logged by most command-line tools and uses it to generate a high-fidelity "screenshot" of your terminal output.
Like time, watch, or perf, just prefix the command you want to screenshot with termshot.
termshot ls -a
This will generate an image file called out.png in the current directory.

In some cases, if your target command contains pipes—there may still be ambiguity, even with --. In these cases, wrap your command in double quotes.
termshot -- "ls -1 | grep go"

Flags to control the look
--show-cmd/-c
Include the target command in the screenshot.
termshot --show-cmd -- "ls -a"

--columns/-C
Enforce that screenshot is wrapped after the provided number of columns. Use this flag to make sure that the screenshot does not exceed a certain horizontal length.
--no-decoration
Do not draw window decorations (minimize, maximize, and close button).
--no-shadow
Do not draw window shadow.
--margin/-m
Add extra space (margin) around the window.
--padding/-p
Add extra space (padding) around the content inside the window.
Flags for output related settings
--clipboard/-b (only on selected platforms)
Do not create an output file with the screenshot, but save the screenshot image into the operating system clipboard.
Note: Only available on some platforms. Check termshot help to see if flag is available.
--filename/-f
Specify a path where the screenshot should be generated. This can be an absolute path or a relative path; relative paths will be resolved relative to the current working directory. Defaults to out.png.
termshot -- "ls -a" # defaults to <cwd>/out.png
termshot --filename my-image.png -- "ls -a"
termshot --filename screenshots/my-image.png -- "ls -a"
termshot --filename /Desktop/my-image.png -- "ls -a"
Flags to control content
--edit/-e
Edit the output before generating the screenshot. This will open the rich text output in the editor configured in $EDITOR, using vi as a fallback. Use this flag to remove unwanted or sensitive output.
termshot --edit -- "ls -a"
Miscellaneous flags
--raw-write <file>
Write command output as-is into the file that is specified as the flag argument. No screenshot is being created. The command-line flag --filename has no effect, when --raw-write is used.
--raw-read <file>
Read input from provided file instead of running a command. If this flag is being used, no pseudo terminal is being created to execute a command. The command-line flags --show-cmd, and --edit have no effect, when --raw-read is used.
--version/-v
Print the version of termshot installed.
$ termshot --version
termshot version 0.2.5
Multiple commands
In order to work, termshot uses a pseudo terminal for the command to be executed. For advanced use cases, you can invoke a fully interactive shell, run several commands, and capture the entire output. The screenshot will be created once you terminate the shell.
termshot /bin/zsh
Please note: This project is work in progress. Although a lot of the ANSI sequences can be parsed, there are definitely commands in existence that create output that cannot be parsed correctly, yet. Also, commands that reset the cursor position are known to create issues.