I want to develop a task manager in Ubuntu Linux. I have a task manager in windows that I am running in Eclipse. I am getting the output. But in Linux, what is the equivalent method for "tasklist.exe" to find the processes running?
Please help me..
ps -ef
will get you all of the tasks running
man ps
will get you all of the options
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class psef
{
public static void main(String args[]) throws Exception
{
try
{
String line;
Process p = Runtime.getRuntime().exec("ps -ef");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null)
{
System.out.println(line);
}
input.close();
}
catch (Exception err)
{
err.printStackTrace();
}
}
}
prathmesh.kallurkar
you can use the ps
command to determine the user, process, usage and other trivia.
Don't you consider top as an equivalent of tasklist.exe?
来源:https://stackoverflow.com/questions/10204433/tasklist-exe-equivalent-in-linux