How to open .TEX files on Linux

To open .TEX files on Linux, to view or edit: Open the .tex file with a text editor from your file manager (it is plain text).

Step-by-step instructions

  1. To view or edit: Open the .tex file with a text editor from your file manager (it is plain text).
  2. To typeset/compile: Run TeX from a terminal (for example, using the tex command provided by TeX Live packages).
  3. If the file type is not recognized: Update shared MIME info / file associations on your desktop environment so .tex maps correctly (many systems use shared-mime-info mappings).

Common issues

Double-clicking opens a blank page or the wrong program

.tex is plain text; if your system associates it with an unsuitable app, it may appear blank or open in a viewer that does not display text properly.

  1. Use “Open with” and choose a plain text editor.
  2. Change the default app association for .tex to a text editor.
  3. If you expected a formatted document, compile the .tex source with a TeX distribution instead of trying to “open” it like a PDF.

TeX cannot find the input file when compiling

TeX often appends “.tex” if you omit the extension; compilation can fail if you run it from the wrong directory or the file name/path is incorrect.

  1. Run the compile command from the folder that contains the .tex file, or provide the full path.
  2. Verify the file name exactly matches (including case on case-sensitive systems).
  3. If you omitted the extension, try specifying the full filename including .tex.

Output is missing content because referenced files are not included

.tex sources often reference additional files (for example, other input files). If those files are not present, compilation may fail or produce incomplete output.

  1. Ensure any referenced companion files are in the expected folders alongside the .tex file.
  2. If you received the file by email or download, ask the sender for the complete project folder rather than only a single .tex file.

Web server or email labels the file with an unexpected MIME type

Many systems use non-IANA “x-” MIME types or local mappings (for example via /etc/mime.types or shared-mime-info). This can affect downloads, previews, and default apps.

  1. If you administer the system, check its MIME mappings (for example /etc/mime.types) and desktop MIME database behavior.
  2. Treat the file as plain text for viewing/editing, regardless of how it is labeled.

Security note

.tex files are plain text, but compiling them invokes a TeX engine that parses and processes commands; only compile TeX sources you trust.

Back to .TEX extension page