← 返回命令列表

Linux command

smartcat 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Process text with AI

echo "[text]" | sc "[summarize this]"

Transform piped input

cat [file.txt] | sc "[translate to French]"

Use with command output

git diff | sc "[write a commit message for these changes]"

Specify a custom prompt template

echo "[text]" | sc -c [my_template]

Use a specific model

echo "[text]" | sc -m [claude]

Interactive mode

sc -i "[explain Kubernetes networking]"

说明

smartcat (command: sc) puts an AI brain behind Unix pipes. It reads from stdin, processes the content with a language model, and writes the result to stdout, fitting naturally into Unix pipelines. The tool is designed for stream-based text transformation: summarizing, translating, reformatting, code reviewing, generating commit messages, and any other text processing task. It follows Unix philosophy by doing one thing well and composing with other tools. Prompt templates define reusable transformations. Templates are stored in the config file and invoked by name with `-c`. This enables consistent, repeatable AI-powered text processing. Supports multiple providers: OpenAI, Anthropic, Mistral, Ollama, and OpenAI-compatible APIs. Configuration is via a TOML file at `~/.config/smartcat/`. Install via `cargo install smartcat`. The command is `sc` for quick typing.

参数

-c, --config _NAME_
Use a named prompt template.
-m, --model _NAME_
Model or API to use.
-i, --interactive
Interactive conversation mode.
-r, --repeat
Repeat last command.
-t, --temperature _FLOAT_
Sampling temperature.
-s, --system-message _TEXT_
System message/persona.
--list-models
List configured models.
--list-configs
List prompt templates.

FAQ

What is the smartcat command used for?

smartcat (command: sc) puts an AI brain behind Unix pipes. It reads from stdin, processes the content with a language model, and writes the result to stdout, fitting naturally into Unix pipelines. The tool is designed for stream-based text transformation: summarizing, translating, reformatting, code reviewing, generating commit messages, and any other text processing task. It follows Unix philosophy by doing one thing well and composing with other tools. Prompt templates define reusable transformations. Templates are stored in the config file and invoked by name with `-c`. This enables consistent, repeatable AI-powered text processing. Supports multiple providers: OpenAI, Anthropic, Mistral, Ollama, and OpenAI-compatible APIs. Configuration is via a TOML file at `~/.config/smartcat/`. Install via `cargo install smartcat`. The command is `sc` for quick typing.

How do I run a basic smartcat example?

Run `echo "[text]" | sc "[summarize this]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c, --config _NAME_ do in smartcat?

Use a named prompt template.