Compile a DVI document, specifying an output directory

tex

tex -output-directory={{path/to/directory}} {{source.tex}}

click the source code to copy install tex on any operating system with command-not-found.com