See the Kpathsearch library documentation (the `Path specifications' node) for the details of how the environment variables are used when searching. The kpsewhich utility can be used to query the values of the variables.
One caveat: In most pdfTeX formats, you cannot use ~ in a filename you give directly to pdfTeX, because ~ is an active character, and hence is expanded, not taken as part of the filename. Other programs, such as Metafont, do not have this problem.
Normally, pdfTeX puts its output files in the
current directory. If any output file cannot be opened there, it
tries to open it in the directory specified in the environment
TEXMFOUTPUT. There is no
default value for that variable. For example, if you say
pdftex paper and the
current directory is not writable, if
TEXMFOUTPUT has the value
/tmp, pdfTeX attempts to create
/tmp/paper.pdf, if any output is produced.)
Search path for
files. This should probably start with ``.'', so that user files
are found before system files. An empty path component will be
replaced with the paths defined in the
texmf.cnf file. For example, set
".:/home/usr/tex:" to prepend the current direcory
``/home/user/tex'' to the standard
earch path for font metric (
Search path for format files.
Search path for pdfinitex internal strings.
Command template for switching to editor. The default, usually vi, is set when pdfTeX is compiled.