exec
Quick Reference
Command Name:
exec
Category:
file management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Process replacement
Replace the current shell with another program without creating a new process
- 2
Resource conservation
Avoid creating nested processes in scripts
- 3
File descriptor manipulation
Permanently redirect I/O for the remainder of a script
- 4
Shell script chaining
Transfer control from one script to another without returning
Syntax
exec [OPTION]... [FILE]...
Options
| Option | Description |
|---|---|
-l |
Use a long listing format |
-a |
Show hidden entries starting with . |
-h |
Human-readable sizes |
-R |
List subdirectories recursively |
Examples
How to Use These Examples
The examples below show common ways to use the exec command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.