"Everything is a file" is what made me start understanding linux few years ago and from there it got easier to use with each new concept.

Still this was really revolutionary to me when I first heard it. Made a bunch of things just click.

Experienced users : archwiki & gentoo handbook, shell scripting, autotools, packaging, and dmesg

new users : "everything is a file"
you are viewing a single comment's thread
view the rest of the comments
[–] 7 points 9 months ago (10 children)

I am curious what you mean by everything is a file... What else would it be?

  • source
  • hideshow 10 child comments
  • [–] 15 points 9 months ago* (last edited 9 months ago)

    It's more a philosophy for Unix systems. When we say that "everything is a file", we're saying that even devices should show up on the filesystem (/dev), even network ports should show up on the filesystem, even processes should show up on the filesystem(/proc), etc... and that is as opposed to having a different system abstraction handle those functions instead.

    Of course when you look deeper into it, linux does not explicitly follow that rule, it more just adheres to it. It's more a guideline than an explicit statement of fact

  • source
  • parent
  • [–] 12 points 9 months ago (2 children)

    It could be a process, which you can talk to only via an IPC call. For example, dbus

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 9 months ago (1 child)

    can't you somehow do IPC via filesystem-based sockets in linux too?

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 9 months ago

    Yea, but socket is not a file. Maybe if you stretch the definition.

    Well in any case, when people say that linux is great because everything is a file, they either mean that:

    • they can edit configuration of most things with a text editor, or that
    • in bash (and other shells) it is easy to work with byte streams, piping them from one process to another and compose complex behaviour from simple commands.
  • source
  • parent
  • [–] 5 points 9 months ago (5 children)

    Yeah I'm interested in how that works too.

    I've recently been looking at the Nextcloud "all in one" Docker image. It works by mounting the docker.sock file into the master container, which allows that container to stand up a whole bunch of other containers on your machine.

    How would that work on Windows, if the Docker socket isn't a file handle?

  • source
  • parent
  • hideshow 5 child comments
  • [–] 3 points 9 months ago (3 children)

    Docker Desktop handles the abstraction in Windows and MacOS. The container thinks it mounted a file.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 9 months ago (2 children)

    and MacOS

    Oh that's interesting. I wonder why they do it that way, considering macOS is a Unix OS.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 9 months ago

    I dunno, but it's a pain. Hiding low-level components from the user to make it more user-friendly.

    I have an old 2014 macbook with a busted GPU temp sensor. The Mac firmware assumes the worst - that the computer is dangerously overheated - and therefore throttles back the CPU by 80% and runs the fans at full blast.

    Fixing it on Mac required a number of third-party tools and flashing a custom firmware. I then installed Linux on the device - about ten lines of script that read from the working temp sensor on the CPU die and write a scaled value to /sys/ in response.

    So much flippin easier on Linux.

  • source
  • parent
  • [–] 2 points 9 months ago

    AIO is a fun one to setup. I found it much easier with portainer. The thing that always catches me with Docker is the permissions after it's setup. I had nextcloud up for a week I could access my external hdd over Webdav and nothing else haha.

  • source
  • parent