Some special files in Unix












0















Background



There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). for proc files it is just a normal files or even text files. But for the rest, I only know how to use them, but I don't know their internal structure and what they are (in depth). And unfortunately, all the way to access file can only get the object which they are escaped for. In other words there is no way to get the content inside them.



Questions



For symlinks, there is no doubt that there is a string which store the paths of their targets. However, if there is only a string, how can they be distinguished from plaintext files? If there is special headers which are specified by filesystem drivers. What are them? Is there any convention about them? Can anyone tell me what is binary representation is about a symlink point at /usr/bin/bash?



For Device files (nod), What are their binary structure and representation? According their behaviors, they mush include the information about relevant interface number and drivers. But it will make their size greatly different. Can anyone explain it in binary level?



For compatibility of symlinks and device file (I know it is impossible for a same device file works in two different environment, but we can use our imagination to make an experiment) is the binary content of these files strongly depend on file system type and the kernel of operating system? For example is I copy (not via cp command), just write identical binary content ) to a different file system (like from ext4 to xfs), is this file (symlinks or device file) still valid and functional? How will it going when copy it from Linux machine to BSD machine?



Or they are not files, they are just special records in file system header part. What it actually is?









share



























    0















    Background



    There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). for proc files it is just a normal files or even text files. But for the rest, I only know how to use them, but I don't know their internal structure and what they are (in depth). And unfortunately, all the way to access file can only get the object which they are escaped for. In other words there is no way to get the content inside them.



    Questions



    For symlinks, there is no doubt that there is a string which store the paths of their targets. However, if there is only a string, how can they be distinguished from plaintext files? If there is special headers which are specified by filesystem drivers. What are them? Is there any convention about them? Can anyone tell me what is binary representation is about a symlink point at /usr/bin/bash?



    For Device files (nod), What are their binary structure and representation? According their behaviors, they mush include the information about relevant interface number and drivers. But it will make their size greatly different. Can anyone explain it in binary level?



    For compatibility of symlinks and device file (I know it is impossible for a same device file works in two different environment, but we can use our imagination to make an experiment) is the binary content of these files strongly depend on file system type and the kernel of operating system? For example is I copy (not via cp command), just write identical binary content ) to a different file system (like from ext4 to xfs), is this file (symlinks or device file) still valid and functional? How will it going when copy it from Linux machine to BSD machine?



    Or they are not files, they are just special records in file system header part. What it actually is?









    share

























      0












      0








      0








      Background



      There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). for proc files it is just a normal files or even text files. But for the rest, I only know how to use them, but I don't know their internal structure and what they are (in depth). And unfortunately, all the way to access file can only get the object which they are escaped for. In other words there is no way to get the content inside them.



      Questions



      For symlinks, there is no doubt that there is a string which store the paths of their targets. However, if there is only a string, how can they be distinguished from plaintext files? If there is special headers which are specified by filesystem drivers. What are them? Is there any convention about them? Can anyone tell me what is binary representation is about a symlink point at /usr/bin/bash?



      For Device files (nod), What are their binary structure and representation? According their behaviors, they mush include the information about relevant interface number and drivers. But it will make their size greatly different. Can anyone explain it in binary level?



      For compatibility of symlinks and device file (I know it is impossible for a same device file works in two different environment, but we can use our imagination to make an experiment) is the binary content of these files strongly depend on file system type and the kernel of operating system? For example is I copy (not via cp command), just write identical binary content ) to a different file system (like from ext4 to xfs), is this file (symlinks or device file) still valid and functional? How will it going when copy it from Linux machine to BSD machine?



      Or they are not files, they are just special records in file system header part. What it actually is?









      share














      Background



      There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). for proc files it is just a normal files or even text files. But for the rest, I only know how to use them, but I don't know their internal structure and what they are (in depth). And unfortunately, all the way to access file can only get the object which they are escaped for. In other words there is no way to get the content inside them.



      Questions



      For symlinks, there is no doubt that there is a string which store the paths of their targets. However, if there is only a string, how can they be distinguished from plaintext files? If there is special headers which are specified by filesystem drivers. What are them? Is there any convention about them? Can anyone tell me what is binary representation is about a symlink point at /usr/bin/bash?



      For Device files (nod), What are their binary structure and representation? According their behaviors, they mush include the information about relevant interface number and drivers. But it will make their size greatly different. Can anyone explain it in binary level?



      For compatibility of symlinks and device file (I know it is impossible for a same device file works in two different environment, but we can use our imagination to make an experiment) is the binary content of these files strongly depend on file system type and the kernel of operating system? For example is I copy (not via cp command), just write identical binary content ) to a different file system (like from ext4 to xfs), is this file (symlinks or device file) still valid and functional? How will it going when copy it from Linux machine to BSD machine?



      Or they are not files, they are just special records in file system header part. What it actually is?







      files filesystems symlink





      share












      share










      share



      share










      asked 8 mins ago









      davmosdavmos

      7317




      7317






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507099%2fsome-special-files-in-unix%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507099%2fsome-special-files-in-unix%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt