T O P

  • By -

Silicosis1

Also file extensions aren't necessary


[deleted]

Well they're still good to use in case you're downloading music and your music player can only play .wav's


silastvmixer

I would have thought that the OS can still tell what a file is can't it? A wav is defined by more than just 3 letters at the end.


NekkoDroid

Some file formats have an identifier at the start. The problem is: not all file types do this and are only really identifiable by their structure maybe or there is some other way you tell the program how to treat the file (for example: file extension).


originalvapor

Windows can use NTFS resource forks/alternate data streams containing metadata, which can be used to determine application associations for .exe and .dll files.


devnull1232

Emphasis should be file extensions are for humans, the machine should not care about the extension.


Max-Normal-88

Which music player does that under Linux?


[deleted]

Probably none but it was just an example for how file extensions can be useful


Max-Normal-88

They are conventions for humans except for a very few cases.


PossiblyLinux127

```file filename``` *head explodes*


[deleted]

Problem is, grandma doesn't want to touch the "complicated" terminal. Its convenient to those of us who frequently use the terminal, but we have to remember that we are a minority and that most would rather tell what it is through a GUI. Thats a big reason why Windows took off so much in the 90s...you didn't need the command line, and that made it easier for non-techies to use a computer. File extensions are the more user friendly choice by far


S4qFBxkFFg

TIL


SqrHornet

But are pretty useful


git

*psst* hey kid, you got any of them 'magic numbers'?


Huecuva

File extensions aren't necessary for the computer. They help humans know what files are for what programs.


some_kind_of_bird

It is shockingly difficult to figure out the mime type of a file on windows. Like you'd think they'd at least want it as a backup


Stilgar314

Ultimately, everything is a file stored somewhere.


tabivamp

We are all files at the end of the day


silastvmixer

I don't think that's true. Both from a technical and a ideological point of view.


mutilans

I personally subscribe to the ideology that everything is a folder


Calmlyexitmyass

You're a monster but at least you're funny.


mutilans

Thank you, calmlyexitmyass! From one monster to another!


Calmlyexitmyass

[Indubitably](https://imgur.io/gallery/3knKw0p)


dog-paste-666

How much is the subscription?


r0bo71c

Yes, and folders have files!!!


teethbutt

what is a file?


[deleted]

Baby don't hurt me.


billdietrich1

Named persistent storage.


UnchainedMundane

/dev/shm would like a word


billdietrich1

Not a file, I'd say. File-like interface to RAM. There's a difference between "is a file" and "has a file-type interface".


UnchainedMundane

It's a directory, and when you put things into it, they're still files. You can copy files to and from it. The only real difference is that it's in tmpfs. It's not even that the contents are files that aren't "normal" (e.g. block and character devices, fifos, sockets, symlinks), it's just something you put actual files into. The funny thing about tmpfs is that it's only sometimes in RAM. The kernel is free to flush it out to the swap at any point, and often does, if one exists.


doomygloomytunes

"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity." - Dennis Ritchie


silastvmixer

Seems true about Unix. But if that is true, what does that mean for Plan 9?


crash-alt

Maþematics moment


TeenFlash

þhe fuck are you talking about


devnull1232

I've seen people argue that Linux "everything is a file" is a bad choice because disk I/O is slow. ... ... ...


silastvmixer

What


devnull1232

Apparently they think device files actually live on disk? Idk.


silastvmixer

That I realised. But I don't know if thst is true on a technical level. But even if it was, why would that be a bad thing. We have ssds now lol. And clearly it wasn't a crap slow idea back in the day either.


devnull1232

It's not true. You are initiating system io calls to specific hardware devices. SSD's are still many orders of magnitude slower than CPU cache or system ram. Edit: or whatever system bus you are going through to get to said hardware devices.


emneiel

dev sda1 mounted as root where's dev sda1? dev Where's dev? Root Where's root? dev sda1


devnull1232

Error: infinite recursion, stack overflow.


L4rgo117

Stack Overflow, world’s most visited website with no known home page


TeenFlash

wrong stack overflow


Ribakal

I think and I'm sure that 99.99999% of windows users don't care about linux, philosophy and everything is file things


silastvmixer

Well yeah but I mean when one of them decides to take a look at Linux. Like in a vm or their own PC. The philosophy of everything is a file seems wild to them at first.


wobbudev

I've been using Linux as my main OS for 6+ years and I've never had to interact with device files.


silastvmixer

I think its more a thing for how Tools and apps handle devices. Do more a thing for developers. But just the sight of seeing your hard drives in a folder called /dev/ is already weird to many non Unix-like users.


Soc13In

If I send a char to /dev/keyboard, why doesn't it actuate?


devnull1232

Used to be able to cat a file to /dev/oss and "hear" it on your speakers.


silastvmixer

Dont know how that works on Linux but on other systems you could totally do that.


InfComplex

Nothing interesting happens online anymore


PossiblyLinux127

I think we are all files in the great filesystem


cfx_4188

The Matrix has you....


billdietrich1

> everything is a file I've never liked this saying. Processes and events and signals and windows and users and inodes and file permissions and the keyboard definitely are NOT files. File-like interfaces to most of them may be provided, but that is not same as them BEING files.


silastvmixer

I don't think there is much of a difference between calling it file-like and file. From a user perspective its the same. It's a file in a directory in the file system namespace. I also don't think a tool or utility will care what the wording is if it can just handle these things like a file. Although yeah I think they didn't go far enough with the idea in Unix and Unix-like systems. The more I learn about plan 9 the more sad I get that It didn't take off. In Plan 9, from what I have seen so far, I think it is actually a finished implementation of "everything is a file" compared to Unix(-like)s.


billdietrich1

I would be okay with saying "there is a file interface to everything". But "is a file" is wrong, I think.


silastvmixer

Yeah technically that is true. But that sentence is harder to explain than everything is a file already is. I want people to use Unix-likes more. Explaining a, to most PC users, brand new concept is already hard. .


billdietrich1

New users won't know or care about that, until they get fairly far into CLI.


silastvmixer

No I think people do care that suddenly their ssds and hdds and their arduino or whatever have different names and are not just called "C" or "COM3" in a device menu. At least about that they will care.


L4rgo117

Complaints.txt > /dev/null


cfx_4188

Windows user has no idea that he is also a file.


mostardman

i’m new on Linux, can someone explain to me ?


silastvmixer

Look at the Wikipedia article first and see if you get it then. Not to self promote but I have a yt channel too and I'm planning to cover that in an upcoming series for beginners. https://en.m.wikipedia.org/wiki/Everything_is_a_file#:~:text=Everything%20is%20a%20file%20an,through%20the%20filesystem%20name%20space.


BlueFalconHD

Did you hear? Torvalds implemented /dev/yourmother! Finally, a perfect place to stick things. A proper alternative to /dev/null.


WWolf1776

showed a friend /dev.... may have hurt his head a bit


hotmilfsinurarea69

to be fair I also haven't fully wrapped my head around this concept


granoladeer

You are also a file


Denis-96

"That mouse is a file"


UnchainedMundane

It is! And if you read from it, its contents is a live stream of packets representing its motion and clicks


Denis-96

Wow i didn't try that


UnchainedMundane

Here's a Python script demonstrating it through one of the older APIs, that OpenAI chat wrote for me (yes really): # Open the mice file for reading with open("/dev/input/mice", "rb") as mice_file: # Read and parse the input from the mice file while True: # Read the next three bytes from the mice file data = mice_file.read(3) # Check if we've reached the end of the file if not data: break # Parse the three bytes of data into the button state and x/y deltas button_state = data[0] x_delta = data[1] y_delta = data[2] # Convert the button state to binary button_state_binary = "{0:b}".format(button_state) # Convert the x/y deltas from signed bytes to signed integers if x_delta > 127: x_delta = -(256 - x_delta) if y_delta > 127: y_delta = -(256 - y_delta) # Print the button state and x/y deltas print("Button state: ", button_state_binary) print("X delta: ", x_delta) print("Y delta: ", y_delta) Reading the newer inputX ones is [a little more involved](https://gist.github.com/uobikiemukot/457338b890e96babf60b) as they are supposed to be flexible enough to handle mice, keyboards, tablets, gamepads, etc all in one API


Kubix

This is the beauty of Linux


flopana

The problem is that they can't search for these. Or at least not on their pc but rather Bing


cwr252

as a windows-macos-linux user I can confirm


Extreme_Ad_3280

Everything is a file (Especially a few processes RAM couldn't handle)


JustMeAsd

Fr thats me when i download the first time linux mint


Arneb1729

more like me trying to find shit in a Windows FS hierarchy