I am quite new to Ubuntu and shell programming. I am using putty to execute vmstat
and iostat
commands on Ubuntu. I need to execute those commands in java (Windows environment) and get an InputStream
of the result. Is it possible?
I am quite new to Ubuntu and shell programming. I am using putty to execute vmstat
and iostat
commands on Ubuntu. I need to execute those commands in java (Windows environment) and get an InputStream
of the result. Is it possible?
Yes. Use plink
(a command-line interface to the PuTTY back end).
plink remote_host "ls -l"
I've successfully used this to, from a Windows-based TFS Build, execute an Android build on a Linux box. So it's possible to work with the output from plink programatically.
Here's an example of how to call a shell command from within Java.