Tasklist.exe equivalent in linux

孤者浪人 提交于 2019-12-03 23:12:36

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!