Use of different output files in LaTeX (pdflatex) [duplicate]

When I use pdflatex, I get a bunch of files:

test.aux
test.log
test.out
test.pdf
test.tex
test.toc


The .tex file and the .pdf file have an obvious use, but what do the other files do?

• .aux is the the "auxiliary" file and is used for (among other things) tracking cross-references made with \label and \ref. This file is why you need to run pdflatex twice to make the references resolve. The first pass writes data about the references to the .aux file and the second reads the .aux file and uses that to generate the necessary references. Generally, anything that needs to wait for the entire document to be generated (like page numbers) is written to .aux so it can be added in on a later pass.
• .log contains a log of what pdflatex did. You can find things like error messages and a list of what packages got loaded in here.
• .out is used to store extra information for the PDF. For example the bookmarks in the PDF file are generated using this file.
• .toc is like .aux but only used for the table of contents, since the proper page numbers can't be known until the PDF has been generated. There are likewise .lof and .lot files for lists of figures and lists of tables.
Except for the .tex file these are all generated by pdflatex and can be safely deleted.