Why is the first field in 'ls - l' not a 'f' when viewing a file? [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
7
down vote
favorite
When I do 'ls -l', I might get something like this:
-rw-r--r-- 1 root root 209 Mar 30 17:41 fname
The first field is the -
, which means this is a file.
If it was a directory and not a file, the first field would be a d
.
Why did the creators of Unix decide to use a d
for directory, which is clear and intuitive, yet use a -
for a file? Why not use f
for a file?
Edit
Really interesting responses. Lots of different ideas, and they all make sense, even if some seem more inadvertently true than implemented for that reason and/or are documented as that being the reason.
terminal ls
closed as primarily opinion-based by Jeff Schaller, telcoM, Goro, RalfFriedl, muru Sep 24 at 15:34
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
 |Â
show 1 more comment
up vote
7
down vote
favorite
When I do 'ls -l', I might get something like this:
-rw-r--r-- 1 root root 209 Mar 30 17:41 fname
The first field is the -
, which means this is a file.
If it was a directory and not a file, the first field would be a d
.
Why did the creators of Unix decide to use a d
for directory, which is clear and intuitive, yet use a -
for a file? Why not use f
for a file?
Edit
Really interesting responses. Lots of different ideas, and they all make sense, even if some seem more inadvertently true than implemented for that reason and/or are documented as that being the reason.
terminal ls
closed as primarily opinion-based by Jeff Schaller, telcoM, Goro, RalfFriedl, muru Sep 24 at 15:34
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
2
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like-
makes the rarer file types (everything else) stand out.
â Wumpus Q. Wumbley
Sep 22 at 19:57
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21
 |Â
show 1 more comment
up vote
7
down vote
favorite
up vote
7
down vote
favorite
When I do 'ls -l', I might get something like this:
-rw-r--r-- 1 root root 209 Mar 30 17:41 fname
The first field is the -
, which means this is a file.
If it was a directory and not a file, the first field would be a d
.
Why did the creators of Unix decide to use a d
for directory, which is clear and intuitive, yet use a -
for a file? Why not use f
for a file?
Edit
Really interesting responses. Lots of different ideas, and they all make sense, even if some seem more inadvertently true than implemented for that reason and/or are documented as that being the reason.
terminal ls
When I do 'ls -l', I might get something like this:
-rw-r--r-- 1 root root 209 Mar 30 17:41 fname
The first field is the -
, which means this is a file.
If it was a directory and not a file, the first field would be a d
.
Why did the creators of Unix decide to use a d
for directory, which is clear and intuitive, yet use a -
for a file? Why not use f
for a file?
Edit
Really interesting responses. Lots of different ideas, and they all make sense, even if some seem more inadvertently true than implemented for that reason and/or are documented as that being the reason.
terminal ls
terminal ls
edited Sep 22 at 20:07
asked Sep 22 at 19:36
Monica Heddneck
1363
1363
closed as primarily opinion-based by Jeff Schaller, telcoM, Goro, RalfFriedl, muru Sep 24 at 15:34
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as primarily opinion-based by Jeff Schaller, telcoM, Goro, RalfFriedl, muru Sep 24 at 15:34
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
2
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like-
makes the rarer file types (everything else) stand out.
â Wumpus Q. Wumbley
Sep 22 at 19:57
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21
 |Â
show 1 more comment
1
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
2
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like-
makes the rarer file types (everything else) stand out.
â Wumpus Q. Wumbley
Sep 22 at 19:57
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21
1
1
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
2
2
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like
-
makes the rarer file types (everything else) stand out.â Wumpus Q. Wumbley
Sep 22 at 19:57
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like
-
makes the rarer file types (everything else) stand out.â Wumpus Q. Wumbley
Sep 22 at 19:57
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
11
down vote
Historically, one of the big design decisions in Unix was to consider everything as a file.ù This transpires in early ls
and stat
manpages; for example, in V3 (February 1973), the stat
manpage (which describes the mode used by ls
) says that
The mode is a six-character string whose characters mean the
following:
s
: file is small (smaller than 4096 bytes)l
: file is large
d
: file is a directoryx
: file is executableu
: set user ID on execution-
: none of the above
etc.
In V4 (October 1973) the mode starts to resemble what we have today; the ls
manpage says
The mode printed under the
-l
option contains 10 characters which are interpreted as follows:
the first character is
d
if the entry is a directory;b
if the entry is a block-type special file;c
if the entry is a character-type special file;-
if the entry is a plain file.
The next 9 characters are interpreted
as three sets of three bits each.
So it seems the creators of Unix really thought that a plain file is âÂÂjustâ the default, nothing special, so it doesnâÂÂt deserve a character â everything is a file, and only files which arenâÂÂt plain files need additional description. One could think of -
as signaling the absence of âÂÂspecialnessâÂÂ.
ù Strictly speaking, the design decision was to make everything accessible through the file system, not to consider everything as a file; but as a result, everything had to be made available as some sort of file, and this required being able to distinguish different types of files. See section 3 of The UNIX Time-Sharing System.
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).
â Stephen Kitt
Sep 22 at 20:47
 |Â
show 4 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
11
down vote
Historically, one of the big design decisions in Unix was to consider everything as a file.ù This transpires in early ls
and stat
manpages; for example, in V3 (February 1973), the stat
manpage (which describes the mode used by ls
) says that
The mode is a six-character string whose characters mean the
following:
s
: file is small (smaller than 4096 bytes)l
: file is large
d
: file is a directoryx
: file is executableu
: set user ID on execution-
: none of the above
etc.
In V4 (October 1973) the mode starts to resemble what we have today; the ls
manpage says
The mode printed under the
-l
option contains 10 characters which are interpreted as follows:
the first character is
d
if the entry is a directory;b
if the entry is a block-type special file;c
if the entry is a character-type special file;-
if the entry is a plain file.
The next 9 characters are interpreted
as three sets of three bits each.
So it seems the creators of Unix really thought that a plain file is âÂÂjustâ the default, nothing special, so it doesnâÂÂt deserve a character â everything is a file, and only files which arenâÂÂt plain files need additional description. One could think of -
as signaling the absence of âÂÂspecialnessâÂÂ.
ù Strictly speaking, the design decision was to make everything accessible through the file system, not to consider everything as a file; but as a result, everything had to be made available as some sort of file, and this required being able to distinguish different types of files. See section 3 of The UNIX Time-Sharing System.
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).
â Stephen Kitt
Sep 22 at 20:47
 |Â
show 4 more comments
up vote
11
down vote
Historically, one of the big design decisions in Unix was to consider everything as a file.ù This transpires in early ls
and stat
manpages; for example, in V3 (February 1973), the stat
manpage (which describes the mode used by ls
) says that
The mode is a six-character string whose characters mean the
following:
s
: file is small (smaller than 4096 bytes)l
: file is large
d
: file is a directoryx
: file is executableu
: set user ID on execution-
: none of the above
etc.
In V4 (October 1973) the mode starts to resemble what we have today; the ls
manpage says
The mode printed under the
-l
option contains 10 characters which are interpreted as follows:
the first character is
d
if the entry is a directory;b
if the entry is a block-type special file;c
if the entry is a character-type special file;-
if the entry is a plain file.
The next 9 characters are interpreted
as three sets of three bits each.
So it seems the creators of Unix really thought that a plain file is âÂÂjustâ the default, nothing special, so it doesnâÂÂt deserve a character â everything is a file, and only files which arenâÂÂt plain files need additional description. One could think of -
as signaling the absence of âÂÂspecialnessâÂÂ.
ù Strictly speaking, the design decision was to make everything accessible through the file system, not to consider everything as a file; but as a result, everything had to be made available as some sort of file, and this required being able to distinguish different types of files. See section 3 of The UNIX Time-Sharing System.
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).
â Stephen Kitt
Sep 22 at 20:47
 |Â
show 4 more comments
up vote
11
down vote
up vote
11
down vote
Historically, one of the big design decisions in Unix was to consider everything as a file.ù This transpires in early ls
and stat
manpages; for example, in V3 (February 1973), the stat
manpage (which describes the mode used by ls
) says that
The mode is a six-character string whose characters mean the
following:
s
: file is small (smaller than 4096 bytes)l
: file is large
d
: file is a directoryx
: file is executableu
: set user ID on execution-
: none of the above
etc.
In V4 (October 1973) the mode starts to resemble what we have today; the ls
manpage says
The mode printed under the
-l
option contains 10 characters which are interpreted as follows:
the first character is
d
if the entry is a directory;b
if the entry is a block-type special file;c
if the entry is a character-type special file;-
if the entry is a plain file.
The next 9 characters are interpreted
as three sets of three bits each.
So it seems the creators of Unix really thought that a plain file is âÂÂjustâ the default, nothing special, so it doesnâÂÂt deserve a character â everything is a file, and only files which arenâÂÂt plain files need additional description. One could think of -
as signaling the absence of âÂÂspecialnessâÂÂ.
ù Strictly speaking, the design decision was to make everything accessible through the file system, not to consider everything as a file; but as a result, everything had to be made available as some sort of file, and this required being able to distinguish different types of files. See section 3 of The UNIX Time-Sharing System.
Historically, one of the big design decisions in Unix was to consider everything as a file.ù This transpires in early ls
and stat
manpages; for example, in V3 (February 1973), the stat
manpage (which describes the mode used by ls
) says that
The mode is a six-character string whose characters mean the
following:
s
: file is small (smaller than 4096 bytes)l
: file is large
d
: file is a directoryx
: file is executableu
: set user ID on execution-
: none of the above
etc.
In V4 (October 1973) the mode starts to resemble what we have today; the ls
manpage says
The mode printed under the
-l
option contains 10 characters which are interpreted as follows:
the first character is
d
if the entry is a directory;b
if the entry is a block-type special file;c
if the entry is a character-type special file;-
if the entry is a plain file.
The next 9 characters are interpreted
as three sets of three bits each.
So it seems the creators of Unix really thought that a plain file is âÂÂjustâ the default, nothing special, so it doesnâÂÂt deserve a character â everything is a file, and only files which arenâÂÂt plain files need additional description. One could think of -
as signaling the absence of âÂÂspecialnessâÂÂ.
ù Strictly speaking, the design decision was to make everything accessible through the file system, not to consider everything as a file; but as a result, everything had to be made available as some sort of file, and this required being able to distinguish different types of files. See section 3 of The UNIX Time-Sharing System.
edited Sep 22 at 20:17
answered Sep 22 at 20:01
Stephen Kitt
148k23326394
148k23326394
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).
â Stephen Kitt
Sep 22 at 20:47
 |Â
show 4 more comments
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).
â Stephen Kitt
Sep 22 at 20:47
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
wait a minute tho....if a plain text file is the expected default, then shouldn't Unix say, "Hey guys, this is just the default thing we like, so give it a hearty "YES"!'. But the dash seems to represent a 'no'. Like 'r-x' means 'no' for 'write'. The dash's meaning is going back and forth as a Yes and a No, so to speak (at least if you look at it this way...)
â Monica Heddneck
Sep 22 at 20:17
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
I take the dash as meaning âÂÂdefaultâÂÂ. Files are plain files (not plain text files, just plain files, as opposed to directories and special files) by default, unreadable by default (i.e. if they donâÂÂt have the read bit set), etc.
â Stephen Kitt
Sep 22 at 20:20
4
4
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
@Sergiy bit of a nitpick, the rest of your comment is fine, but no, the MIME type isnâÂÂt the header... (How are file types known if not from file suffix?)
â Stephen Kitt
Sep 22 at 20:31
2
2
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
@Sergiy, no, there is no header. There are heuristics to try to guess a fileâÂÂs type but there is no guaranteed header, or magic number, etc. All sorts of fun and games can be had by abusing those guesses.
â Stephen Kitt
Sep 22 at 20:34
2
2
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.
file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).â Stephen Kitt
Sep 22 at 20:47
@Sergiy I know what youâÂÂre trying to convey, but in my experience itâÂÂs too simplistic and it ends up confusing users.
file
, and the shared MIME database, apply a sequence of detection tests, some of which look at the first few bytes of a file. But claiming that the first few bytes of a file give an indication of its type gives readers the wrong impression. There is no guaranteed way of determining a file type (unlike Mac OS Classic or PalmOS where each file had a type and creator code).â Stephen Kitt
Sep 22 at 20:47
 |Â
show 4 more comments
1
Directory is a file, just a special type. So it makes sense to indicate that's a special type of file with d, but it's pointless for regular file. See askubuntu.com/q/1073802/295286 and askubuntu.com/a/1073805/295286 There's a few historical notes there on the topic.
â Sergiy Kolodyazhnyy
Sep 22 at 19:49
Wow, thanks for the links. Reading now.
â Monica Heddneck
Sep 22 at 19:50
Let me know if you have any questions or any parts of the answers need clarification.
â Sergiy Kolodyazhnyy
Sep 22 at 19:51
2
If you assume that regular files are the most common thing to be found in a directory listing, then representing them by a small character like
-
makes the rarer file types (everything else) stand out.â Wumpus Q. Wumbley
Sep 22 at 19:57
Understanding UNIX permissions and file types might be relevant here.
â Stephen Kitt
Sep 22 at 20:21