I have Windows 10 Professional x64 with WSL2 installed. I've also installed Ubuntu 20.04 LTS from Microsoft Store.
I can type ubuntu2004
in the CMD and get access to Linux utils installed under Ubuntu. For example, I've installed the poppler-utils
and now have pdfunite
:
My disk C:\
is already mounted in the Ubuntu filesystem as /mnt/c
and I have full access to it from my Ubuntu:
Suppose I have copied (under Windows) two PDF files into this directory, say 1.pdf
and 2.pdf
:
And I wish to combine them using pdfunite
from Ubuntu, but I want to perform this programmatically from Mathematica, without using the terminal interface. Under the terminal, it would be sufficient just to type:
pdfunite 1.pdf 2.pdf combined.pdf
But how can I do this from Mathematica using perhaps such commands as RunProcess
or ExternalEvaluate
?
P.S. pdfunite
is just an example. Actually I wish to understand how I can use any Ubuntu command-line utility from Mathematica installed on Windows.
RunProcess[{"wsl", "pdfunite", "1.pdf", "2.pdf", "combined.pdf"}]
, assuming the PDFs are on the path and all. $\endgroup$ubuntu2004 run pdfunite 1.pdf 2.pdf combined.pdf
works! $\endgroup$