Explain “In Linux and UNIX, everything is a file” [closed]
Please anybody tell me the means of above stanza.
"In Linux and UNIX, everything is a file"
files
closed as off-topic by Eric Carvalho, guntbert, vidarlo, wjandrea, user68186 Dec 26 '18 at 21:30
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Eric Carvalho, guntbert, vidarlo, user68186
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
Please anybody tell me the means of above stanza.
"In Linux and UNIX, everything is a file"
files
closed as off-topic by Eric Carvalho, guntbert, vidarlo, wjandrea, user68186 Dec 26 '18 at 21:30
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Eric Carvalho, guntbert, vidarlo, user68186
If this question can be reworded to fit the rules in the help center, please edit the question.
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59
add a comment |
Please anybody tell me the means of above stanza.
"In Linux and UNIX, everything is a file"
files
Please anybody tell me the means of above stanza.
"In Linux and UNIX, everything is a file"
files
files
edited Dec 24 '18 at 5:08
Pablo Bianchi
2,3741528
2,3741528
asked Dec 23 '18 at 5:43
Abhishek kamal
6
6
closed as off-topic by Eric Carvalho, guntbert, vidarlo, wjandrea, user68186 Dec 26 '18 at 21:30
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Eric Carvalho, guntbert, vidarlo, user68186
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Eric Carvalho, guntbert, vidarlo, wjandrea, user68186 Dec 26 '18 at 21:30
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Eric Carvalho, guntbert, vidarlo, user68186
If this question can be reworded to fit the rules in the help center, please edit the question.
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59
add a comment |
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59
add a comment |
1 Answer
1
active
oldest
votes
The statement is ambiguous and there is no single definition, but in general there are several interpretations:
Objects can be operated on via same or similar utilities to those that are used for files. To quote Linus Torvalds:
The whole point with "everything is a file" is not that you have some
random filename (indeed, sockets and pipes show that "file" and "filename"
have nothing to do with each other), but the fact that you can use common
tools to operate on different things.
Notable example of those are network sockets. Although syscalls to operate on those are different, the concepts are the same. Pipes, in reality, are pairs of file descriptors, so writing to them is done via same
write()
andread()
syscalls as for files ( although it's not possible to uselseek()
on them ).
The reality of computers is that data makes sense within context. To one application data may be just stream of bytes, and to another - meaningful input. Thus under Linux/Unix operating systems having common tools to handle data, but let applications decide how they handle that data is the crucial part.
Consistent set of tools to handle different items in file-like way is also significant. Consider for instance file descriptors: we can have exactly same object which we may open and read, but that object could be network socket, anonymous or named pipe, a file that is loaded into memory, etc.
Items have inode number on their respective filesystems. In particular, directories are just files that are lists of inodes. Pipes have inode on kernel's virtual pipefs. Thus, the idea here is that there's a consistent way to abstract and identify different objects via same methods; i.e. keyword here is consistency. See also What are directories, if everything on Linux is a file?
One of the nice features of Linux kernels is the ability to provide virtual filesystems. To quote chaos on the related ( if not cross site-duplicate ) question:
The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was corrected to say "Everything is a file descriptor". Linus Torvalds himself corrected it again a bit more precisely: "Everything is a stream of bytes".
Of course, following the concept of consistency, the virtual filesystem objects are abstracted via the same means as on the real filesystem - inode number which references a particular entity on the filesystem. What the structure of that filesystem may be should be irrelevant - same tools should apply and objects should be referenced in the same way, as they are just sequences of bytes.
Devices can be represented as file-like object under
/dev/
filesystem. This statement is often questioned, particularly with Linus's quote above. Strictly speaking, they aren't "files" in traditional meaning of file on hard drive, which contain data within (Though Wikipedia article on this topic states exactly device-file representation as the interpretation in the opening paragraph). The objects such as/dev/sda1
block devices and/dev/zero
character device are object that connect to device driver in kernel. Read Gilles's answer on the related post
However, it's worth admitting that such approach also has been widely applied. In particular, some of the original creators of Unix also worked on Plan 9 operating system. To quote PH7 article:
For instance, the Plan 9 operating system pioneered a fully integrated approach to system resources: A cornerstone of Plan 9 vision was the objective to represent not only devices and communication channels but all system interfaces through the filesystem. For instance, Plan 9 designers noted that in UNIX, network devices cannot completely be considered as regular files: They are accessed through sockets which have distinct opening semantics and which reside in a different name space (host and port for internet sockets). Plan 9 implementation demonstrated that you could successfully unify all local and remote devices in a global namespace. This concept eventually came back to UNIX in the form of portalfs.
Side note: a related post cites 1990 document FILE SYSTEM DESIGN USING LARGE MEMORIES by Carl Staelin and Hector Garcia-Molina, which states:
In iPcress everything is a file, including the indexed table of file headers (inode table). This is an extension of the UNIX philosophy that “all files are simply a stream of bytes".
Thus, it may be as well that original design of Unix intended for common interface which treated streams of bytes equally via same utilities, which inevitably grew into "everything is a file" philosophy, though it's fairly accurate to say that files in reality are just organized sequences of bytes.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The statement is ambiguous and there is no single definition, but in general there are several interpretations:
Objects can be operated on via same or similar utilities to those that are used for files. To quote Linus Torvalds:
The whole point with "everything is a file" is not that you have some
random filename (indeed, sockets and pipes show that "file" and "filename"
have nothing to do with each other), but the fact that you can use common
tools to operate on different things.
Notable example of those are network sockets. Although syscalls to operate on those are different, the concepts are the same. Pipes, in reality, are pairs of file descriptors, so writing to them is done via same
write()
andread()
syscalls as for files ( although it's not possible to uselseek()
on them ).
The reality of computers is that data makes sense within context. To one application data may be just stream of bytes, and to another - meaningful input. Thus under Linux/Unix operating systems having common tools to handle data, but let applications decide how they handle that data is the crucial part.
Consistent set of tools to handle different items in file-like way is also significant. Consider for instance file descriptors: we can have exactly same object which we may open and read, but that object could be network socket, anonymous or named pipe, a file that is loaded into memory, etc.
Items have inode number on their respective filesystems. In particular, directories are just files that are lists of inodes. Pipes have inode on kernel's virtual pipefs. Thus, the idea here is that there's a consistent way to abstract and identify different objects via same methods; i.e. keyword here is consistency. See also What are directories, if everything on Linux is a file?
One of the nice features of Linux kernels is the ability to provide virtual filesystems. To quote chaos on the related ( if not cross site-duplicate ) question:
The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was corrected to say "Everything is a file descriptor". Linus Torvalds himself corrected it again a bit more precisely: "Everything is a stream of bytes".
Of course, following the concept of consistency, the virtual filesystem objects are abstracted via the same means as on the real filesystem - inode number which references a particular entity on the filesystem. What the structure of that filesystem may be should be irrelevant - same tools should apply and objects should be referenced in the same way, as they are just sequences of bytes.
Devices can be represented as file-like object under
/dev/
filesystem. This statement is often questioned, particularly with Linus's quote above. Strictly speaking, they aren't "files" in traditional meaning of file on hard drive, which contain data within (Though Wikipedia article on this topic states exactly device-file representation as the interpretation in the opening paragraph). The objects such as/dev/sda1
block devices and/dev/zero
character device are object that connect to device driver in kernel. Read Gilles's answer on the related post
However, it's worth admitting that such approach also has been widely applied. In particular, some of the original creators of Unix also worked on Plan 9 operating system. To quote PH7 article:
For instance, the Plan 9 operating system pioneered a fully integrated approach to system resources: A cornerstone of Plan 9 vision was the objective to represent not only devices and communication channels but all system interfaces through the filesystem. For instance, Plan 9 designers noted that in UNIX, network devices cannot completely be considered as regular files: They are accessed through sockets which have distinct opening semantics and which reside in a different name space (host and port for internet sockets). Plan 9 implementation demonstrated that you could successfully unify all local and remote devices in a global namespace. This concept eventually came back to UNIX in the form of portalfs.
Side note: a related post cites 1990 document FILE SYSTEM DESIGN USING LARGE MEMORIES by Carl Staelin and Hector Garcia-Molina, which states:
In iPcress everything is a file, including the indexed table of file headers (inode table). This is an extension of the UNIX philosophy that “all files are simply a stream of bytes".
Thus, it may be as well that original design of Unix intended for common interface which treated streams of bytes equally via same utilities, which inevitably grew into "everything is a file" philosophy, though it's fairly accurate to say that files in reality are just organized sequences of bytes.
add a comment |
The statement is ambiguous and there is no single definition, but in general there are several interpretations:
Objects can be operated on via same or similar utilities to those that are used for files. To quote Linus Torvalds:
The whole point with "everything is a file" is not that you have some
random filename (indeed, sockets and pipes show that "file" and "filename"
have nothing to do with each other), but the fact that you can use common
tools to operate on different things.
Notable example of those are network sockets. Although syscalls to operate on those are different, the concepts are the same. Pipes, in reality, are pairs of file descriptors, so writing to them is done via same
write()
andread()
syscalls as for files ( although it's not possible to uselseek()
on them ).
The reality of computers is that data makes sense within context. To one application data may be just stream of bytes, and to another - meaningful input. Thus under Linux/Unix operating systems having common tools to handle data, but let applications decide how they handle that data is the crucial part.
Consistent set of tools to handle different items in file-like way is also significant. Consider for instance file descriptors: we can have exactly same object which we may open and read, but that object could be network socket, anonymous or named pipe, a file that is loaded into memory, etc.
Items have inode number on their respective filesystems. In particular, directories are just files that are lists of inodes. Pipes have inode on kernel's virtual pipefs. Thus, the idea here is that there's a consistent way to abstract and identify different objects via same methods; i.e. keyword here is consistency. See also What are directories, if everything on Linux is a file?
One of the nice features of Linux kernels is the ability to provide virtual filesystems. To quote chaos on the related ( if not cross site-duplicate ) question:
The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was corrected to say "Everything is a file descriptor". Linus Torvalds himself corrected it again a bit more precisely: "Everything is a stream of bytes".
Of course, following the concept of consistency, the virtual filesystem objects are abstracted via the same means as on the real filesystem - inode number which references a particular entity on the filesystem. What the structure of that filesystem may be should be irrelevant - same tools should apply and objects should be referenced in the same way, as they are just sequences of bytes.
Devices can be represented as file-like object under
/dev/
filesystem. This statement is often questioned, particularly with Linus's quote above. Strictly speaking, they aren't "files" in traditional meaning of file on hard drive, which contain data within (Though Wikipedia article on this topic states exactly device-file representation as the interpretation in the opening paragraph). The objects such as/dev/sda1
block devices and/dev/zero
character device are object that connect to device driver in kernel. Read Gilles's answer on the related post
However, it's worth admitting that such approach also has been widely applied. In particular, some of the original creators of Unix also worked on Plan 9 operating system. To quote PH7 article:
For instance, the Plan 9 operating system pioneered a fully integrated approach to system resources: A cornerstone of Plan 9 vision was the objective to represent not only devices and communication channels but all system interfaces through the filesystem. For instance, Plan 9 designers noted that in UNIX, network devices cannot completely be considered as regular files: They are accessed through sockets which have distinct opening semantics and which reside in a different name space (host and port for internet sockets). Plan 9 implementation demonstrated that you could successfully unify all local and remote devices in a global namespace. This concept eventually came back to UNIX in the form of portalfs.
Side note: a related post cites 1990 document FILE SYSTEM DESIGN USING LARGE MEMORIES by Carl Staelin and Hector Garcia-Molina, which states:
In iPcress everything is a file, including the indexed table of file headers (inode table). This is an extension of the UNIX philosophy that “all files are simply a stream of bytes".
Thus, it may be as well that original design of Unix intended for common interface which treated streams of bytes equally via same utilities, which inevitably grew into "everything is a file" philosophy, though it's fairly accurate to say that files in reality are just organized sequences of bytes.
add a comment |
The statement is ambiguous and there is no single definition, but in general there are several interpretations:
Objects can be operated on via same or similar utilities to those that are used for files. To quote Linus Torvalds:
The whole point with "everything is a file" is not that you have some
random filename (indeed, sockets and pipes show that "file" and "filename"
have nothing to do with each other), but the fact that you can use common
tools to operate on different things.
Notable example of those are network sockets. Although syscalls to operate on those are different, the concepts are the same. Pipes, in reality, are pairs of file descriptors, so writing to them is done via same
write()
andread()
syscalls as for files ( although it's not possible to uselseek()
on them ).
The reality of computers is that data makes sense within context. To one application data may be just stream of bytes, and to another - meaningful input. Thus under Linux/Unix operating systems having common tools to handle data, but let applications decide how they handle that data is the crucial part.
Consistent set of tools to handle different items in file-like way is also significant. Consider for instance file descriptors: we can have exactly same object which we may open and read, but that object could be network socket, anonymous or named pipe, a file that is loaded into memory, etc.
Items have inode number on their respective filesystems. In particular, directories are just files that are lists of inodes. Pipes have inode on kernel's virtual pipefs. Thus, the idea here is that there's a consistent way to abstract and identify different objects via same methods; i.e. keyword here is consistency. See also What are directories, if everything on Linux is a file?
One of the nice features of Linux kernels is the ability to provide virtual filesystems. To quote chaos on the related ( if not cross site-duplicate ) question:
The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was corrected to say "Everything is a file descriptor". Linus Torvalds himself corrected it again a bit more precisely: "Everything is a stream of bytes".
Of course, following the concept of consistency, the virtual filesystem objects are abstracted via the same means as on the real filesystem - inode number which references a particular entity on the filesystem. What the structure of that filesystem may be should be irrelevant - same tools should apply and objects should be referenced in the same way, as they are just sequences of bytes.
Devices can be represented as file-like object under
/dev/
filesystem. This statement is often questioned, particularly with Linus's quote above. Strictly speaking, they aren't "files" in traditional meaning of file on hard drive, which contain data within (Though Wikipedia article on this topic states exactly device-file representation as the interpretation in the opening paragraph). The objects such as/dev/sda1
block devices and/dev/zero
character device are object that connect to device driver in kernel. Read Gilles's answer on the related post
However, it's worth admitting that such approach also has been widely applied. In particular, some of the original creators of Unix also worked on Plan 9 operating system. To quote PH7 article:
For instance, the Plan 9 operating system pioneered a fully integrated approach to system resources: A cornerstone of Plan 9 vision was the objective to represent not only devices and communication channels but all system interfaces through the filesystem. For instance, Plan 9 designers noted that in UNIX, network devices cannot completely be considered as regular files: They are accessed through sockets which have distinct opening semantics and which reside in a different name space (host and port for internet sockets). Plan 9 implementation demonstrated that you could successfully unify all local and remote devices in a global namespace. This concept eventually came back to UNIX in the form of portalfs.
Side note: a related post cites 1990 document FILE SYSTEM DESIGN USING LARGE MEMORIES by Carl Staelin and Hector Garcia-Molina, which states:
In iPcress everything is a file, including the indexed table of file headers (inode table). This is an extension of the UNIX philosophy that “all files are simply a stream of bytes".
Thus, it may be as well that original design of Unix intended for common interface which treated streams of bytes equally via same utilities, which inevitably grew into "everything is a file" philosophy, though it's fairly accurate to say that files in reality are just organized sequences of bytes.
The statement is ambiguous and there is no single definition, but in general there are several interpretations:
Objects can be operated on via same or similar utilities to those that are used for files. To quote Linus Torvalds:
The whole point with "everything is a file" is not that you have some
random filename (indeed, sockets and pipes show that "file" and "filename"
have nothing to do with each other), but the fact that you can use common
tools to operate on different things.
Notable example of those are network sockets. Although syscalls to operate on those are different, the concepts are the same. Pipes, in reality, are pairs of file descriptors, so writing to them is done via same
write()
andread()
syscalls as for files ( although it's not possible to uselseek()
on them ).
The reality of computers is that data makes sense within context. To one application data may be just stream of bytes, and to another - meaningful input. Thus under Linux/Unix operating systems having common tools to handle data, but let applications decide how they handle that data is the crucial part.
Consistent set of tools to handle different items in file-like way is also significant. Consider for instance file descriptors: we can have exactly same object which we may open and read, but that object could be network socket, anonymous or named pipe, a file that is loaded into memory, etc.
Items have inode number on their respective filesystems. In particular, directories are just files that are lists of inodes. Pipes have inode on kernel's virtual pipefs. Thus, the idea here is that there's a consistent way to abstract and identify different objects via same methods; i.e. keyword here is consistency. See also What are directories, if everything on Linux is a file?
One of the nice features of Linux kernels is the ability to provide virtual filesystems. To quote chaos on the related ( if not cross site-duplicate ) question:
The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was corrected to say "Everything is a file descriptor". Linus Torvalds himself corrected it again a bit more precisely: "Everything is a stream of bytes".
Of course, following the concept of consistency, the virtual filesystem objects are abstracted via the same means as on the real filesystem - inode number which references a particular entity on the filesystem. What the structure of that filesystem may be should be irrelevant - same tools should apply and objects should be referenced in the same way, as they are just sequences of bytes.
Devices can be represented as file-like object under
/dev/
filesystem. This statement is often questioned, particularly with Linus's quote above. Strictly speaking, they aren't "files" in traditional meaning of file on hard drive, which contain data within (Though Wikipedia article on this topic states exactly device-file representation as the interpretation in the opening paragraph). The objects such as/dev/sda1
block devices and/dev/zero
character device are object that connect to device driver in kernel. Read Gilles's answer on the related post
However, it's worth admitting that such approach also has been widely applied. In particular, some of the original creators of Unix also worked on Plan 9 operating system. To quote PH7 article:
For instance, the Plan 9 operating system pioneered a fully integrated approach to system resources: A cornerstone of Plan 9 vision was the objective to represent not only devices and communication channels but all system interfaces through the filesystem. For instance, Plan 9 designers noted that in UNIX, network devices cannot completely be considered as regular files: They are accessed through sockets which have distinct opening semantics and which reside in a different name space (host and port for internet sockets). Plan 9 implementation demonstrated that you could successfully unify all local and remote devices in a global namespace. This concept eventually came back to UNIX in the form of portalfs.
Side note: a related post cites 1990 document FILE SYSTEM DESIGN USING LARGE MEMORIES by Carl Staelin and Hector Garcia-Molina, which states:
In iPcress everything is a file, including the indexed table of file headers (inode table). This is an extension of the UNIX philosophy that “all files are simply a stream of bytes".
Thus, it may be as well that original design of Unix intended for common interface which treated streams of bytes equally via same utilities, which inevitably grew into "everything is a file" philosophy, though it's fairly accurate to say that files in reality are just organized sequences of bytes.
edited Dec 23 '18 at 7:08
answered Dec 23 '18 at 5:51
Sergiy Kolodyazhnyy
69.9k9144307
69.9k9144307
add a comment |
add a comment |
What Does “Everything Is a File” Mean in Linux? - How to Geek, Everything is a file - Wikipedia, A layman's explanation for “Everything is a file” — what differs from Windows?
– wjandrea
Dec 26 '18 at 20:55
Possible duplicate of What are directories, if everything on Linux is a file?
– wjandrea
Dec 26 '18 at 20:59