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.print(data); } System.out.println("** END OF LOOP **"); } catch(IOException ioexception) { ioexception.printStackTrace(); }