There have been multiple questions asked about this, like Understanding ls output, What are columns in ls -la?, What does 'ls -la' do?, What do the fields in ls -al output mean?, etc..
I've also come across many other websites with articles attempting to explain it.
What every single one of them seems to have in common is that despite writing down the meaning of the columns, there are never any links/references to where they acquired that information in the first place. An answer in the third question links to the coreutils manual, but much like the manpage that still provides no clarification.
The aforementioned resources are incomplete, as I'm developing a driver and found out ls -l
provides the major and minor number for block/character devices (which is different from the regular output for files or directories):
Here the major/minor numbers for the device are 1 and 3 respectively.
I only discovered this because someone mentioned it in an answer (unrelated question). Had I wanted to know what these numbers meant before, I probably wouldn't have been able to find out save for the unlikely event I stumbled on that answer. Or went looking in the source code.
It seems pretty weird for a tool that pretty much every single linux user uses, not to have any proper information available about it's output. So am I missing something? Where is it documented?
EDIT: Muru in the comments referred to yet another question How to find what the fields in ls -l mean - the suggested answers in that question mention mostly the manpages (one outright pastes it), which for GNU coreutils does not provide a complete answer (manpage makes no mention of major/minor device numbers). The BSD manpage does, but Stephen's answer of the posix standard is (I think) the most correct.
If the file is a character special or block special file, the major and minor device numbers for the file are displayed in the size field.
. I suppose that's the one question I didn't find before. But also I'm not on BSD, so I might have skipped it if I had. Only with the hindisght of now knowing it's POSIX would I have taken it to be a correct source. – TrisT Mar 24 '24 at 09:29ls -l
, are you? :) – Kaz Mar 24 '24 at 16:07