Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating 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

If I do pdflatex *.tex in a directory, only one tex file is compiled. Which syntax should I use that all *.tex files in the directory are compiled?

share|improve this question
up vote 7 down vote accepted


for file in *.tex; do pdflatex "$file"; done
share|improve this answer

pdflatex apparently only takes one argument. I can think of using find -exec

find -name '*.tex' -maxdepth 1 -exec pdflatex {} \;

But there may be better alternatives.

share|improve this answer

Less typing, if no spaces in files:

 echo *.tex|xargs -n1 pdflatex
share|improve this answer

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.