Open In App

exec command in Linux with examples

exec command in Linux is used to execute a command from the bash itself. This command does not create a new process it just replaces the bash with the command to be executed. If the exec command is successful, it does not return to the calling process.

Syntax:



exec [-cl] [-a name] [command [arguments]] [redirection ...]

Options:

Note: exec command does not create a new process. When we run the exec command from the terminal, the ongoing terminal process is replaced by the command that is provided as the argument for the exec command.



The exec command can be used in two modes:

Article Tags :