Tasklist.exe equivalent in linux

2019-04-02 23:18发布

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..

2条回答
可以哭但决不认输i
2楼-- · 2019-04-02 23:48

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?

查看更多
欢心
3楼-- · 2019-04-03 00:04

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();
    }
}
}
查看更多
登录 后发表回答