Restore `/usr/bin/latex` on ubuntu [duplicate]

I wanted to uninstall texlive on ubuntu and used apt remove texlive but some program still found /usr/bin/latex so I removed that by hand (rm). When I reinstalled texlive with apt install texlive the /usr/bin/latex file was not restored.


Solution 1:

You can find out which installed package the file the you deleted belongs to using

dpkg -S /usr/bin/latex

Then reinstall that package (it's probably texlive-latex-base)

sudo apt install --reinstall texlive-latex-base

Solution 2:

It may be a good idea to install texlive-full, so that all available LaTeX packages are installed as well (you won't get missing something.sty errors, and wouldn't have to manually find how to fix them).

The following command should reinstall any missing files.

sudo apt install --reinstall texlive-full