int dup(int oldfd);
int dup2(int oldfd, int newfd);
- dup makes a copy of the old file descriptor at the next available file descriptor location.
- dup2 allows you to specify what the new file descriptor should be
- If newfd is open, it is closed
- After this, both the old and the new file descriptors are available and the same.