NAME dup, dup2 - duplicate a file descriptor SYNOPSIS #include int dup(int oldfd); int dup2(int oldfd, int newfd); DESCRIPTION dup and dup2 create a copy of the file descriptor oldfd. After successful return of dup or dup2, the old and new descriptors may be used interchangeably.