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).
/etc/
are many years old, both by mtime and ctime. I'd hardly call them temporary in practice. – ilkkachu Apr 11 '18 at 12:31