Skip to main content
ubuntuask.com

Back to all posts

Files and processes in Unix

Published on
2 min read

Table of Contents

Show more
Files and processes in Unix image

In a Unix system, the two fundamental notion is that things are either a file or a process. A file is just a destination for or a source of a stream of data.

A process on the other hand is a program that is currently running and this program may be associated with a file that either stores the instructions that the program runs or a file that stores the output that the program generates. Files in a Unix system basically are a collection of data that can be referred to by name. Files can be created manually by users of the system or programmatically by running programs or processes.

In a Unix system, a directory is just a file that contains links to other files. Other examples of a file include a text document, a program file (i.e written in python or JavaScript) or an image file.

  • Stdin, Stdout and Stderror
  • Stdin, Stdout and Stderror are default files in Unix with specific responsibilities.
  • Stdin : Default sources of data. In the case of typing a command on the terminal, the default input is the keyboard.
  • Stdout : Default destination for data. In the case of running a command on the terminal, the default output is the screen
  • Stderr : Error messages can be redirected and sent to a file instead of being displayed on the screen. It can be sent to a specific filename or to a /dev/null device/destination. In the command shell, we can refere to these default sources / destinations using numbers.

stidn -0

stdout -1

stderr -2