Linux中的Tasklist.exe等效文件 [英] Tasklist.exe equivalent in linux
本文介绍了Linux中的Tasklist.exe等效文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Ubuntu Linux中开发任务管理器.我在Eclipse中运行的Windows中有一个任务管理器.我正在获取输出.但是在Linux中,"tasklist.exe"查找正在运行的进程的等效方法是什么?
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?
请帮助我.
推荐答案
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();
}
}
}
这篇关于Linux中的Tasklist.exe等效文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文