我想在Ubuntu Linux中开发一个任务管理器。我在Eclipse中运行了一个任务管理器。我得到了输出。但是在Linux中,“tasklist.exe”找到正在运行的进程的等效方法是什么?
请帮帮我..
答案 0 :(得分:1)
您可以使用ps
命令来确定用户,进程,用法和其他琐事。
你不认为top等同于tasklist.exe吗?
答案 1 :(得分:1)
ps -ef
将为您提供所有正在运行的任务
man ps
会为您提供所有选项
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();
}
}
}