Shell
sh
POSIX-compliant shell — the standard portable Unix shell.
Synopsis
syntax
sh [OPTION]... [FILE [ARG]...]
Examples
Run a script in POSIX shell
sh script.sh
Execute inline command
sh -c 'echo hello'
Run with tracing enabled
sh -x deploy.sh
Common options
| Flag | Description |
|---|---|
| -c | Execute commands from string |
| -x | Trace mode |
| -e | Exit on error |
| -n | Syntax check only |
About sh
The `sh` command pOSIX-compliant shell — the standard portable Unix shell. Shell commands configure your interactive environment — variables, aliases, history, and shell options.
The shell is your primary interface with Linux, and customizing it improves productivity. These commands work across bash, zsh, and other POSIX-compatible shells with minor differences.
The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man sh`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Shell Commands
Other commands in the Shell category