What is the main difference between a temporary file and a regular file in the Linux world?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












What is the main difference between a temporary file ("tempfile") and a regular file in the Linux world?



The only main difference I recon between these two inodes is that in general, a "temporary file" has a much shorter life cycle than a "regular file", from whatever reason, while both are by principle, practically temporary (at least from the fact this universe is heading to a total heat death).




After reading an answer to this question, I think that newbies like myself should go read these sessions, respectively:



  1. How does a pipe differ from a temporary file?


  2. How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)?







share|improve this question






















  • Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
    – roaima
    Apr 11 at 12:17











  • I agree, no problem, I just wanted to say what I understand so far.
    – user9303970
    Apr 11 at 12:20











  • "practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
    – ilkkachu
    Apr 11 at 12:31















up vote
0
down vote

favorite












What is the main difference between a temporary file ("tempfile") and a regular file in the Linux world?



The only main difference I recon between these two inodes is that in general, a "temporary file" has a much shorter life cycle than a "regular file", from whatever reason, while both are by principle, practically temporary (at least from the fact this universe is heading to a total heat death).




After reading an answer to this question, I think that newbies like myself should go read these sessions, respectively:



  1. How does a pipe differ from a temporary file?


  2. How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)?







share|improve this question






















  • Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
    – roaima
    Apr 11 at 12:17











  • I agree, no problem, I just wanted to say what I understand so far.
    – user9303970
    Apr 11 at 12:20











  • "practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
    – ilkkachu
    Apr 11 at 12:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











What is the main difference between a temporary file ("tempfile") and a regular file in the Linux world?



The only main difference I recon between these two inodes is that in general, a "temporary file" has a much shorter life cycle than a "regular file", from whatever reason, while both are by principle, practically temporary (at least from the fact this universe is heading to a total heat death).




After reading an answer to this question, I think that newbies like myself should go read these sessions, respectively:



  1. How does a pipe differ from a temporary file?


  2. How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)?







share|improve this question














What is the main difference between a temporary file ("tempfile") and a regular file in the Linux world?



The only main difference I recon between these two inodes is that in general, a "temporary file" has a much shorter life cycle than a "regular file", from whatever reason, while both are by principle, practically temporary (at least from the fact this universe is heading to a total heat death).




After reading an answer to this question, I think that newbies like myself should go read these sessions, respectively:



  1. How does a pipe differ from a temporary file?


  2. How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)?









share|improve this question













share|improve this question




share|improve this question








edited Apr 11 at 12:25









ilkkachu

48.5k669134




48.5k669134










asked Apr 11 at 12:04









user9303970

116224




116224











  • Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
    – roaima
    Apr 11 at 12:17











  • I agree, no problem, I just wanted to say what I understand so far.
    – user9303970
    Apr 11 at 12:20











  • "practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
    – ilkkachu
    Apr 11 at 12:31

















  • Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
    – roaima
    Apr 11 at 12:17











  • I agree, no problem, I just wanted to say what I understand so far.
    – user9303970
    Apr 11 at 12:20











  • "practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
    – ilkkachu
    Apr 11 at 12:31
















Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
– roaima
Apr 11 at 12:17





Feel free to answer your own question, but please separate the Question and the Answer. Don't answer it in the question. This way, others can upvote (or downvote) your answer independently of the question you've asked.
– roaima
Apr 11 at 12:17













I agree, no problem, I just wanted to say what I understand so far.
– user9303970
Apr 11 at 12:20





I agree, no problem, I just wanted to say what I understand so far.
– user9303970
Apr 11 at 12:20













"practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
– ilkkachu
Apr 11 at 12:31





"practically temporary"? Some files in my /etc/ are many years old, both by mtime and ctime. I'd hardly call them temporary in practice.
– ilkkachu
Apr 11 at 12:31











2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










There is absolutely no difference between a temporary file and a regular file.



A temporary file is a regular file, and a regular file is "regular" as opposed to being a directory, or a device special file, or named pipe etc.



The only difference is, as you point out, the typical use of the file. When a program or script creates a "temporary file", it is typically a regular file that is used to store temporary data that is not needed beyond the lifetime of the process that created it. Such files are often created in $TMPDIR.



POSIX defines:




File: An object that can be written to, or read from, or both. A file has certain attributes, including access permissions and type. File types include regular file, character special file, block special file, FIFO special file, symbolic link, socket, and directory. Other types of files may be supported by the implementation.



Regular file: A file that is a randomly accessible sequence of bytes, with no further structure imposed by the system.




It does not, however, care to say anything about the definition of a "temporary file", because it's not a specific file type (rather, a way of using regular files).






share|improve this answer



























    up vote
    1
    down vote













    There is no technical difference between a temporary file and a regular file.



    Semantically it would be reasonable to assume the following statements:



    1. A temporary file should be short-lived

    2. A temporary file may be intentionally deleted from the filesystem (by the application itself) while it is still in use

    3. A long-lived temporary file may be unexpectedly deleted from the filesystem (by a cleanup process) while it is still in use

    4. A temporary file should usually be created under /tmp or /var/tmp





    share|improve this answer




















      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f436995%2fwhat-is-the-main-difference-between-a-temporary-file-and-a-regular-file-in-the-l%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      There is absolutely no difference between a temporary file and a regular file.



      A temporary file is a regular file, and a regular file is "regular" as opposed to being a directory, or a device special file, or named pipe etc.



      The only difference is, as you point out, the typical use of the file. When a program or script creates a "temporary file", it is typically a regular file that is used to store temporary data that is not needed beyond the lifetime of the process that created it. Such files are often created in $TMPDIR.



      POSIX defines:




      File: An object that can be written to, or read from, or both. A file has certain attributes, including access permissions and type. File types include regular file, character special file, block special file, FIFO special file, symbolic link, socket, and directory. Other types of files may be supported by the implementation.



      Regular file: A file that is a randomly accessible sequence of bytes, with no further structure imposed by the system.




      It does not, however, care to say anything about the definition of a "temporary file", because it's not a specific file type (rather, a way of using regular files).






      share|improve this answer
























        up vote
        3
        down vote



        accepted










        There is absolutely no difference between a temporary file and a regular file.



        A temporary file is a regular file, and a regular file is "regular" as opposed to being a directory, or a device special file, or named pipe etc.



        The only difference is, as you point out, the typical use of the file. When a program or script creates a "temporary file", it is typically a regular file that is used to store temporary data that is not needed beyond the lifetime of the process that created it. Such files are often created in $TMPDIR.



        POSIX defines:




        File: An object that can be written to, or read from, or both. A file has certain attributes, including access permissions and type. File types include regular file, character special file, block special file, FIFO special file, symbolic link, socket, and directory. Other types of files may be supported by the implementation.



        Regular file: A file that is a randomly accessible sequence of bytes, with no further structure imposed by the system.




        It does not, however, care to say anything about the definition of a "temporary file", because it's not a specific file type (rather, a way of using regular files).






        share|improve this answer






















          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          There is absolutely no difference between a temporary file and a regular file.



          A temporary file is a regular file, and a regular file is "regular" as opposed to being a directory, or a device special file, or named pipe etc.



          The only difference is, as you point out, the typical use of the file. When a program or script creates a "temporary file", it is typically a regular file that is used to store temporary data that is not needed beyond the lifetime of the process that created it. Such files are often created in $TMPDIR.



          POSIX defines:




          File: An object that can be written to, or read from, or both. A file has certain attributes, including access permissions and type. File types include regular file, character special file, block special file, FIFO special file, symbolic link, socket, and directory. Other types of files may be supported by the implementation.



          Regular file: A file that is a randomly accessible sequence of bytes, with no further structure imposed by the system.




          It does not, however, care to say anything about the definition of a "temporary file", because it's not a specific file type (rather, a way of using regular files).






          share|improve this answer












          There is absolutely no difference between a temporary file and a regular file.



          A temporary file is a regular file, and a regular file is "regular" as opposed to being a directory, or a device special file, or named pipe etc.



          The only difference is, as you point out, the typical use of the file. When a program or script creates a "temporary file", it is typically a regular file that is used to store temporary data that is not needed beyond the lifetime of the process that created it. Such files are often created in $TMPDIR.



          POSIX defines:




          File: An object that can be written to, or read from, or both. A file has certain attributes, including access permissions and type. File types include regular file, character special file, block special file, FIFO special file, symbolic link, socket, and directory. Other types of files may be supported by the implementation.



          Regular file: A file that is a randomly accessible sequence of bytes, with no further structure imposed by the system.




          It does not, however, care to say anything about the definition of a "temporary file", because it's not a specific file type (rather, a way of using regular files).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 11 at 12:18









          Kusalananda

          102k13199316




          102k13199316






















              up vote
              1
              down vote













              There is no technical difference between a temporary file and a regular file.



              Semantically it would be reasonable to assume the following statements:



              1. A temporary file should be short-lived

              2. A temporary file may be intentionally deleted from the filesystem (by the application itself) while it is still in use

              3. A long-lived temporary file may be unexpectedly deleted from the filesystem (by a cleanup process) while it is still in use

              4. A temporary file should usually be created under /tmp or /var/tmp





              share|improve this answer
























                up vote
                1
                down vote













                There is no technical difference between a temporary file and a regular file.



                Semantically it would be reasonable to assume the following statements:



                1. A temporary file should be short-lived

                2. A temporary file may be intentionally deleted from the filesystem (by the application itself) while it is still in use

                3. A long-lived temporary file may be unexpectedly deleted from the filesystem (by a cleanup process) while it is still in use

                4. A temporary file should usually be created under /tmp or /var/tmp





                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  There is no technical difference between a temporary file and a regular file.



                  Semantically it would be reasonable to assume the following statements:



                  1. A temporary file should be short-lived

                  2. A temporary file may be intentionally deleted from the filesystem (by the application itself) while it is still in use

                  3. A long-lived temporary file may be unexpectedly deleted from the filesystem (by a cleanup process) while it is still in use

                  4. A temporary file should usually be created under /tmp or /var/tmp





                  share|improve this answer












                  There is no technical difference between a temporary file and a regular file.



                  Semantically it would be reasonable to assume the following statements:



                  1. A temporary file should be short-lived

                  2. A temporary file may be intentionally deleted from the filesystem (by the application itself) while it is still in use

                  3. A long-lived temporary file may be unexpectedly deleted from the filesystem (by a cleanup process) while it is still in use

                  4. A temporary file should usually be created under /tmp or /var/tmp






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 11 at 12:16









                  roaima

                  39.4k545106




                  39.4k545106






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436995%2fwhat-is-the-main-difference-between-a-temporary-file-and-a-regular-file-in-the-l%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?