EXEC(3)
Linux Programmer’s Manual
EXEC(3)
NAME
execl, execlp, execle, execv, execvp − execute a file
SYNOPSIS
#include <unistd.h>
extern char **environ;
int execl(const char * path, const char *arg, ...);
int execlp(const char * file, const char *arg, ...);
int execle(const char *path, const char *arg,
..., char * const envp[]);
int execv(const char * path, char *const argv[]);
int execvp(const char * file, char *const argv[]);
DESCRIPTION
The exec() family of functions replaces the current process image with a new process image. The functions
described in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further
details about the replacement of the current process image.)
The initial argument for these functions is the pathname of a file which is to be executed.
The const char *arg and subsequent ellipses in the execl(), execlp(), and execle() functions can be thought
of as arg0, arg1, ..., argn. Together they describe a list of one or more pointers to null-terminated strings
that represent the argument list available to the executed program. The first argument, by convention,
should point to the filename associated with the file being executed. The list of arguments must be termi-
nated by a NULL pointer, and, since these are variadic functions, this pointer must be cast (char *) NULL.
The execv() and execvp() functions provide an array of pointers to null-terminated strings that represent the
argument list available to the new program. The first argument, by convention, should point to the filename
associated with the file being executed. The array of pointers must be terminated by a NULL pointer.
The execle() function also specifies the environment of the executed process by following the NULL
pointer that terminates the list of arguments in the argument list or the pointer to the argv array with an
additional argument. This additional argument is an array of pointers to null-terminated strings and must
be terminated by a NULL pointer. The other functions take the environ