File Descriptors
File descriptors are numbered IDs that are set up each time the kernel starts a process. These numbers are what the process uses to write output and read input. There are three file descriptors that are opened by default:
F.D. 0 | STDIN. This is where standard input comes from. It is normally the keyboard, but it can be redirected to read from a file or some other source. |
F.D. 1 | STDOUT. This is where standard output goes. It is normally the screen, but as you have seen it can be redirected. |
F.D. 2 | STDERR. This is where standard error messages go. Once again, it is normally the screen, but it can also be redirected. |
File descriptors can be used in shell programs to make your programs both more efficient and easier to write. The ...
Get FreeBSD® Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.