TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the quickest way to check (on Linux) whether I already have a given package? In particular I'm interested in whether there is something that will take less time than the 20 seconds or so it would take me to create a tiny latex document and try to compile it.

share|improve this question
up vote 25 down vote accepted
kpsewhich pkgname.sty
kpsewhich clsname.cls
share|improve this answer
And this not only tells you if you have the package, but also the path where it's installed. – Juan A. Navarro Aug 16 '10 at 14:25

The standard tool works not only on Linux but also on Windows systems: at the command prompt, the command

kpsewhich name.sty

prints path and file name of one file name.sty if it can be found, otherwise nothing.

kpsewhich -all name.sty

prints all occurences if there are several (try kpsewhich -all texmf.cnf).

It uses ls-R files but could search the disk as well if you specify the option -must-exist. kpsewhich recognizes a lot of format names. Beside tex formats like .cls, .sty, .tex it finds font files, bib files and many more.


kpsewhich --help


man kpsewhich

to learn more or have a look at this kpsewhich manpage.

This standalone program belongs to the kpathsea library. To read about it, type

texdoc kpathsea

at the command prompt. As you may know, texdoc is another very useful command for the shell.

share|improve this answer
Although the additional information in your answer is useful, I've accepted Geoffrey's because he was first, and besides, you don't need the extra rep. – Mark Meckes Aug 16 '10 at 14:42
@Mark: don't worry, it's fine :) I was just typing and thought I'll send as well. – Stefan Kottwitz Aug 16 '10 at 14:46
@Mark, @Stefan: yay! rep! :)) – Geoffrey Jones Aug 16 '10 at 14:50

Your Answer


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.