Input/output redirection
In this chapter, we will discuss redirection in Linux in detail.
Simply put, redirection is pretty much exactly as the word implies: the redirecting of something to something else. For example, we've already seen that we can use the output of one command as the input for the next command, using pipes. Pipes are implemented in Linux using the |
sign.
However, that might raise the question: how does Linux deal with input and output in the first place? We'll begin our journey into redirection with some theory on file descriptors, which are what make all redirection possible!
File descriptors
You might be tired of hearing it, but it is still no less true: in Linux, everything is a file. We've seen that a file is a file, a directory is a file, even hard disks are files; but now, we'll take this one step further: your keyboard, which you use for input, is also a file!
Complementary to that, your Terminal, which commands use as output, is, guess what: a file.
You can find these...