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)
linuxmemes
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
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
sudoin 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 figures
We 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.
"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.
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.
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.
wait til you gentoo and find out even folders themselves are files(as far as the machine interprets it anyway)
Isn't that.. Normal tho?
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...
Why aren't the Linux devs just using SMB to forward the mouse and keyboard files? Are they stupid?
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...
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.
What's the difference between this and the classic "ssh user@server" ?
we're fans of internet horror memes and being loud in libraries. so we love scp and hate ssh
π
Don't judge me
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.
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.
Just make the entire filesystem 777. And bypass the ssh warning when id_rsa is too permissible.
By god, imagine the labor savings we're about to experience
I am curious what you mean by everything is a file... What else would it be?
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
It could be a process, which you can talk to only via an IPC call. For example, dbus
can't you somehow do IPC via filesystem-based sockets in linux too?
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.
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?
Docker Desktop handles the abstraction in Windows and MacOS. The container thinks it mounted a file.
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.
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.
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.
Until you discover dbus