World Library  
Flag as Inappropriate
Email this Article

Temporary file

Article Id: WHEBN0000622756
Reproduction Date:

Title: Temporary file  
Author: World Heritage Encyclopedia
Language: English
Subject: Temporary folder, Temporary, Temporary variable, Disk utility, BleachBit
Collection: Computer File Systems
Publisher: World Heritage Encyclopedia

Temporary file

Temporary files, or foo files (.TMP), are files created to temporarily contain information while a new file is being made. It may be created by computer programs for a variety of purposes; principally when a program cannot allocate enough memory for its tasks, when the program is working on data bigger than the architecture's address space, or as a primitive form of inter-process communication.


  • Auxiliary memory 1
  • Inter-process communication 2
  • Creation 3
  • Issues 4
  • See also 5

Auxiliary memory

Modern operating systems employ virtual memory, however programs that use large amounts of data (e.g. video editing) may need to create temporary file(s).

Inter-process communication

Most operating systems offer primitives such as pipes, sockets or shared memory to pass data among programs, but often the simplest way (especially for programs that follow the Unix philosophy) is to write data into a temporary file and inform the receiving program of the location of the temporary file.


On POSIX systems, temporary files can be safely created with the or library functions. Some systems provide a non-POSIX program. These files are typically located in the standard temporary directory, /tmp on Unix machines or %TEMP% (which is log-in specific) on Windows machines.

A temporary file created with is deleted automatically when the program exits or the file is closed. To generate a temporary file name that will survive past the lifespan of the creating program, (POSIX) or GetTempFileName(...) (Windows) can be used.


Some programs create temporary files and then leave them behind - they do not delete them. This can happen because the program crashed or the developer of the program simply forgot to add the code needed to delete the temporary files after the program is done with them. The temporary files left behind can accumulate over time and consume a lot of disk space.

Temporary files may be deleted manually. Operating systems may clear out the temporary directory on a reboot, and they may have "cleaner" scripts that remove files if they have not been accessed in a certain amount of time. Also, memory-based systems, such as tmpfs, inherently do not preserve files across a reboot.

See also

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.