Explanation of “Everything is a File” and Types of Files in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

6 Responses

  1. Leopoldo says:

    Hi, I am just understanding all these stuff. What is the relation between socket files and ports (e.g. port:80) in regards of “everything is a file” philosophy?

    • Aaron Kili says:

      @Leopoldo

      Ports are communication end-points that are associated with different applications on an operating system such as 80 for HTTP server, 22 for SSH etc. Applications listen on a particular port and clients that want to request services or connect to them do that via the port.

      On the other hand, a socket file allows communication between processes over a network after a connection between two applications via a port.

      In conclusion, a client must first access an application running on a network via a port, before two or more processes on the client and application can communicate via a socket: a socket is bound to a port number.

      • Leopoldo says:

        Thank you for the clarification Aaron.

        Once the communication is stablished through the port (btw, these ports are (physically) associated only to the CPU? the CPU of the cliente or of the server?) then how does the socket file knows that every task or process must be conducted through this specific port? How these tasks avoid to get lost in the network or motherboard? (A kind of header mentioning the port in each socket files just created, for example?)

        Sorry for my dummies questions.

        Thank you in advance for your gently explanations.

        • Aaron Kili says:

          @Leopoldo

          As i mentioned before, all sockets in an application are bound to the port used by the application. Considering a connection-oriented(over a network) client-to-server model, when the server is running, the socket on it waits for requests from a client for a service(s).

          The server first of all establishes (binds) an address that clients can use to find the server process; then it waits for clients to requests.

          Most importantly, the exchange of data between the server and a client practically happens when the client connects to the server through a socket; the server performs the client’s request and sends a response back to the client —- as simple as that.

          You can read more about sockets from IBM Knowledge center: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/rzab6/howdosockets.htm

          Lastly, about this: “Sorry for my dummies questions.” – Never be afraid of asking, it helps you to understand better and learn.

  2. Humberto says:

    Great explanation of the different types of files and some useful examples of how they can be used. Thank you!

Got something to say? Join the discussion.

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