Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just have installed TeX-Live 2012, but I still get

moose@pc07:~$ latex --version
pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian)
kpathsea version 5.0.0
Copyright 2009 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.2.42; using libpng 1.2.42
Compiled with zlib 1.2.3.3; using zlib 1.2.3.3
Compiled with poppler version 0.12.4

So I've wondered if I could find out where the binary that gets executed when I enter latex --version is located. Is this possible?

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

The type command is built-in to bash (which is a standalone program).

type latex

The type command can also differentiate between shell aliases, shell functions and standalone programs if you pass the -a option: I have an alias for ls

$ type -a ls
ls is aliased to `ls -F'
ls is /bin/ls
share|improve this answer
add comment

You can use

which latex

to find out the location of a binairy.

share|improve this answer
add comment

For simple stand-alone commands the above answers are perfectly correct. However, if you are running complex scripts and you want to know what's happening behind the scenes, the best way is always:

ps afxu

that displays the entire tree of command being executed.

For example, running ps afxu while updating grub2 with os-prober enabled produces this output:

root      4304  0.0  0.0  27308  1700 ?        Ss   16:33   0:00 SCREEN -S update-grub
root      4305  0.9  0.1  23540  4648 pts/2    Ss   16:33   0:00  \_ /bin/bash
root      4371  0.0  0.0   4392   744 pts/2    S+   16:33   0:00      \_ /bin/sh /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
root      5127  0.0  0.0   4396   756 pts/2    S+   16:33   0:00          \_ /bin/sh /etc/grub.d/30_os-prober
root      7029  0.0  0.0   4396   176 pts/2    S+   16:33   0:00              \_ /bin/sh /etc/grub.d/30_os-prober
root      7030  0.0  0.0   4396   464 pts/2    S+   16:33   0:00                  \_ /bin/sh /etc/grub.d/30_os-prober
root      7038  0.0  0.1  23660  4676 pts/2    D+   16:33   0:00                  |   \_ /usr/sbin/grub-probe --device /dev/sdb3 --target=fs_uuid
root      7031  0.0  0.0  11520   828 pts/2    S+   16:33   0:00                  \_ sed -e s/^/\t/

In this way you can know exactly what is being called by an executable/script in each phase of its execution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.