我是linux的新手,我正在努力学习更多,我就是在这种情况下遇到的。
我尝试过使用ps命令和grep来捕获"ca“,但它返回"ca”的每一个实例,无论它来自什么,它实际上对我没有帮助。
我试过这个办法,但行不通。
ps aux | grep ca
find out the process id
and issue kill <process number>
但是grep将捕获所有的"ca“,不管它在哪里,在进程名,目录和任何东西中。
我应该做些什么来实现我所需要的。提前感谢
在ps的管理中
tid TID the unique number representing a dispatchable
entity (alias lwp, spid). This value may also
appear as: a process ID (pid); a process group
ID (pgrp); a session ID for the session leader
我想通过类似于java -jar xxx.jar的命令行执行一个程序
然后获取程序的进程ID。
稍后通过进程ID判断进程是否处于活动状态。
//start a process
String command = "...";
ProcessBuilder pb = new ProcessBuilder(command);
Process process = pb.start();
//get the pid of process
if (System.getProperty("os.name").toLowerCase().contains("mac
当我为某个进程执行topas时,在CPU%列中显示43%,并跳转到85%。
当我执行:
"ps aux | grep processName"
同样的工艺为5%。
更准确的是什么?我还做了一个类似于Linux "watch“命令的循环,我看到它在%5。
托帕斯和ps有什么区别,谁是对的?
ps的输出:
[ttfai231:root]/root>ps aux | head -1; ps aux | sort -rn +2 | head -10
USER PID %CPU %MEM SZ RSS TTY STAT STIME
我希望打开(或创建进程)目录的特定位置,并关闭(或终止进程)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace WindowsFormsApplic