Question: I have been following a system programming course recently and I came through the system calls **exec()** and **execve()**. So far I cannot find any difference between these two, Even the Wikipedia does not give a clear explanation, so is there a difference between **exec()** and **execve()**. 

And someone please could give brief descriptions about exec family system calls such as **execl()**, **execv()**, **execle()**, **execvp()**.

Answer: 
Use [`man exec`](http://man7.org/linux/man-pages/man3/execl.3.html) and read:

```
The execv(), execvp(), and execvpe() 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. 

```

`execv`

```
int execv(const char *path, char *const argv[]);

```

So you pass an array as parameters

```
int execle(const char *path, const char *arg,
              ..., char * const envp[]);

```

Almost the same, but not as an array, but rather as a list of values (strings), followed by an array the designates the environment.

Here:

```
int execvp(const char *file, char *const argv[]);

```

You are calling a file, without path, so it expects you to be already in the right `path` before calling.

Last but not least:

```
int execve(const char *filename, char *const argv[],
                  char *const envp[]);

```

Similar to previous one, but now you have two arrays, for arguments and environment variables.
The arguments are different for these functions.

* The function execl, execlp, and execle require each of the command line arguments to the new program to be specified as separate arguments.
* The execv, execvp and execve, we have to build an array of pointers to the arguments, and the address of this array is the argument to these three functions.
* The execve, execle functions allow us to pass the pointer to an array of pointers to the environment strings. The other four functions use the `environ` variable in the calling process to copy the existing environment to the program.
* The letter `p` means that the functions takes a file name argument and uses the PATH environment variable to find the executable file.
* The letter `l` means that the function takes a list of arguments and is mutually exclusive with the letter `v`, which means that it takes an argv[] vector.
* The letter `e` means that the function takes an `envp[]` array instead of using the current environment.
* The new program inherits the following additional features from the calling process.

```none
    Process ID and the Parent Process ID
    Real user ID and Real Group ID
    Supplementary group IDs
    Process group ID
    Session ID
    Controlling terminal
    Time left until alarm clock
    Current working directory
    Root directory
    File mode creation mask
    File locks
    Process signal mask
    Pending signals
    Resource limits
    Values for tms_utime, tms_stime, tms_cutime, and tms_cstime.

```

* The real user ID and the real group ID remain the same across the exec but the effective IDs can change, depending on the status of the set-user-id and the set-group-id bits for the program file executed.