import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Ps { public static void main(String[] args) { try { String command = "ps aux"; Process process = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String data = ""; while((data = reader.readLine()) != null) { System.out.println(data); } System.out.println("** END OF LOOP **"); } catch(IOException ioexception) { ioexception.printStackTrace(); } } }