FILES IN LINUX First of all, there are two kinds of files: physical files and virtual files. Linux (like most operating systems) allows you to treat physical and virtual files in nearly the same way, even though they aren't the same thing at all. Physical file: a file on your hard drive. A sequence of bytes with a beginning and an ending. Virtual file: something you can read or write to, as though it were a file, even though it's not really: keyboard, screen, socket, pipe. These are not real files, but the OS treats them as such so that your code still works on them. Every open file has a file descriptor, which is a non-negative integer. 0 always refers to "standard input" 1 always refers to "standard output" 2 always refers to "standard error". 0 is often the keyboard, but it doesn't have to be. You can set a file on the system to be fd 0, and now the input will come from that file. % coolgame This runs the coolgame program and input comes from the keyboard. % coolgame < answers.in Now, coolgame runs but instead of me typing information from the keyboard, the input comes from answers.in