Linux® and Files

 

Everything in Linux® is treated as if it were a file. Directories, hardware, memory, network, you name it, Linux at the core, treats it like a file. Even software that runs is treated like a file. Why a file? Well, files can be written to, can be read from, can be appended to, can be removed, can be created, can be modified… in other words, you can do a lot of things to a file. You can also enforce some standardization and rules about the files. So, files. Files files files.

That being said, there are three important files that Linux® has. They’re called:

  • standard in (stdin)
  • standard out (stdout)
  • standard error (stderr)

These are all created for you by Linux®, you don’t have to do a thing to make them work. You just have to use them.

  •  Standard in
    This is the file that is set up for all input into processes by default. In other words, it’s read directly from the keyboard. If you start a process and it wants you to type, it’s reading from the standard in file.
  • Standard out
    This is the default file for output from a process. If you start a process from the command line, it’s going to print output into the terminal that you started it from. Now, not everything writes output of any sort, but by default, they put it to standard out.
  • Standard error
    Not everything goes as planned… which means not every process runs as planned. Whether by user error or computer error… errors happen. The errors are sent to a different stream than standard out. But to make things confusing, on a basic terminal that means they’re printed to the same place standard out goes to.

Leave a Reply

Your email address will not be published. Required fields are marked *