A file descriptor is a small non-negative integer the kernel gives a process to refer to an open file, socket, pipe or device; the per-process table points to system-wide open file entries.
By convention 0 is standard input, 1 is standard output and 2 is standard error; redirection (>, 2>&1, <) and pipes (|) work by rewiring these descriptors.
Each process has a limit on open descriptors (ulimit -n); the error "too many open files" usually means a leak (sockets or files not closed) or a low limit.
Loading…