this post was submitted on 15 Jan 2026
353 points (99.2% liked)

linuxmemes

28952 readers
2505 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. πŸ‡¬πŸ‡§ Language/язык/Sprache
  • This is primarily an English-speaking community. πŸ‡¬πŸ‡§πŸ‡¦πŸ‡ΊπŸ‡ΊπŸ‡Έ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • Β 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS
     

    "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.

    all 43 comments
    sorted by: hot top controversial new old
    [–] Fedop@slrpnk.net 4 points 2 days ago

    Just in case, I have to share this great explanation of the term "everything is a file": https://unix.stackexchange.com/questions/141016/a-laymans-explanation-for-everything-is-a-file-what-differs-from-windows#141020

    This really helped clear things up for me, the main idea is that everything is represented by the filesystem, so you can use the same file-manipulation tools on a ton of systems.

    [–] MrChewy@lemmy.world 25 points 3 days ago (2 children)

    I may be dumb, been on linux too long or a combination of both. But what other way is there, does windows work differently? (regarding that)

    [–] rtxn@lemmy.world 61 points 3 days ago* (last edited 3 days ago) (1 children)

    "Everything is a file" means that many of the system's components are represented as abstractions in the filesystem. It's simply an API that allows reading from and writing to it by integrating into the hierarchical file structure.

    If you take a look inside /sys, you will find a fuckton of files, but they don't represent data stored on a mass storage medium. Instead, the directory contains a mounted sysfs filesystem that contains file-like representations of various parts and properties of the system. For example, you can read them like a file by running cat /sys/block/sda/queue/rotational to check if the sda block device is a spinning disk (1) or solid-state storage (0). Or you can write to them like a file by running echo 1 > /sys/block/sda/devices/delete to command sda's driver to detach the device. Similarly, /proc contains a mounted procfs filesystem that presents information about running processes as file-like entries; /dev contains a mounted devfs that points to various devices; and /tmp and /run contain tmpfs mounts for temporary storage in volatile memory (RAM or swap).

    Windows uses various other APIs (like the Component Object Model and others) to accomplish the same that are not necessarily tied into the filesystem.

    [–] TimeSquirrel@kbin.melroy.org 27 points 3 days ago (1 children)

    Exactly the same concept as memory-mapped hardware I/O, or virtual file system drivers. Makes it so you don't have to think too much about implementation details and uses a common interface that's already there.

    [–] ByteJunk@lemmy.world 10 points 3 days ago

    Sensible, yes.

    But this is alien tech in windows land, if you're reading some device status or something, you need a special app for that.

    [–] Dialectical_Specialist@quokk.au 15 points 3 days ago (1 children)

    wait til you gentoo and find out even folders themselves are files(as far as the machine interprets it anyway)

    [–] 87Six@lemmy.zip 7 points 2 days ago

    Isn't that.. Normal tho?

    [–] janet_catcus@lemmy.blahaj.zone 12 points 3 days ago (2 children)

    it's all fun and games until you want to use your mouse and keyboard inputs on another machine and also view the other machines screen contents. then all of a sudden stuff stops being a file. quaint.

    if only there was a way to share resources over a network...

    [–] FooBarrington@lemmy.world 11 points 3 days ago (2 children)

    Why aren't the Linux devs just using SMB to forward the mouse and keyboard files? Are they stupid?

    [–] mumblerfish@lemmy.world 23 points 3 days ago

    What do you mean? This

    remoteuser@server$ nc -l -p 4444 > /dev/input/event0
    
    
    localuser@laptop$ cat /dev/input/event0 | nc server 4444
    

    doesn't work?

    eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeew scoots faaaar away from you actually when writing the prior comment, i was thinking about the ease that is doing what i described on plan9, there everything is in fact a file, which you can simply mount via the 9p protocol

    what mumblerfish suggests looks interesting and i would have to read some the man page of "nc", i suppose...

    [–] FauxLiving@lemmy.world 6 points 3 days ago (1 children)

    I've figured out how to control computers remotely and I'll share the script:

    Client:

    #!/bin/bash
    PASSWORD="your_password_here"
    sshpass -p "$PASSWORD" scp /dev/stdin user@server:/path/to/cmd.txt <<< "$1"
    

    Server:

    #!/bin/bash
    while true; do
        while IFS= read -r line; do
            eval "$line"
        done < "cmd.txt"
        > "cmd.txt"
    done
    

    Just chmod 777 both files and run as root, ez.

    [–] jim3692@discuss.online 4 points 2 days ago (1 children)

    What's the difference between this and the classic "ssh user@server" ?

    [–] FauxLiving@lemmy.world 2 points 2 days ago (1 children)

    we're fans of internet horror memes and being loud in libraries. so we love scp and hate ssh

    [–] jim3692@discuss.online 3 points 2 days ago (2 children)
    [–] FauxLiving@lemmy.world 1 points 1 day ago

    Don't judge me

    [–] caseyweederman@lemmy.ca 0 points 1 day ago (1 children)

    In case you were genuinely curious: the above humorous example bypasses very many very good safety precautions and conveniences.
    When you boil everything down, one element stands out: the s in scp stands for ssh, so you are in fact still using ssh, just with several hoops bolted on.

    [–] FauxLiving@lemmy.world 2 points 1 day ago (1 children)

    the above humorous example bypasses very many very good safety precautions and conveniences.

    I was taught in school that security and convenience are diametrically opposed, so if you can find any way of making this less secure/more convenient I'd be happy to deploy it to the entire credit union.

    [–] caseyweederman@lemmy.ca 2 points 1 day ago (1 children)

    Just make the entire filesystem 777. And bypass the ssh warning when id_rsa is too permissible.

    [–] FauxLiving@lemmy.world 2 points 1 day ago

    By god, imagine the labor savings we're about to experience

    [–] MrSoup@lemmy.zip 2 points 2 days ago

    Until you discover dbus

    [–] Korhaka@sopuli.xyz 8 points 3 days ago (3 children)

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

    [–] JayDee@lemmy.sdf.org 13 points 3 days ago* (last edited 3 days 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

    [–] verstra@programming.dev 13 points 3 days ago (1 children)

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

    [–] gandalf_der_12te@discuss.tchncs.de 3 points 2 days ago (1 children)

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

    [–] verstra@programming.dev 1 points 2 days 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.
    [–] Zagorath@aussie.zone 5 points 3 days ago (2 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?

    [–] MCHEVA4EVA@lemmy.world 2 points 2 days 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.

    [–] Peruvian_Skies@sh.itjust.works 4 points 3 days ago (1 children)

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

    [–] Zagorath@aussie.zone 3 points 3 days ago (2 children)

    and MacOS

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

    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.

    I just said that Docker Desktop handles it. I've never used a Mac so I don't know for sure what's going on under the hood there but I imagine that everything they can do the same between Mac and Linux, they do. It's easier that way.