Skip to main content
The command action allows you to execute shell commands and scripts directly from your workflows. This is useful for system automation, running scripts, processing files, or integrating with command-line tools.
Be cautious when using user input in commands. Always validate and sanitize inputs to prevent command injection attacks.

command

Executes shell commands and returns their output.

Command

The shell command to execute. The command is executed in the system’s default shell. You can use pipes, redirects, and other shell features.

Examples

Basic Command

List files in a directory:

Run a Script

Execute a script file:

Command with Dynamic Values

Use workflow data in commands (with caution):

Chained Commands

Use pipes and shell operators:

Process Command Output

Use the command output in subsequent actions:

Environment Variables

Access environment variables in commands:

Security Considerations

Never directly interpolate user input into commands. This can lead to command injection vulnerabilities.

Unsafe Pattern

Safer Pattern

Validate and sanitize input before use:

Common Use Cases


Next Steps

Memory

Cache command results for reuse.

Transformation

Process command output with JavaScript.

Flow Control

Run multiple commands in parallel.

Actions Overview

Learn the fundamentals of ServFlow actions.