Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 列出当前目录中正在运行的进程_Macos_Terminal_Ps - Fatal编程技术网

Macos 列出当前目录中正在运行的进程

Macos 列出当前目录中正在运行的进程,macos,terminal,ps,Macos,Terminal,Ps,是否有可能使用ps命令列出当前目录中所有当前正在运行的进程?例如,我在同一目录中有a、b和c.exe(c程序)程序存储,我只想在终端上运行这三个进程时列出它们。什么操作系统?我假设Linux(或基于Unix的东西),因为你说的是ps,但你说的是c.exe…我在使用Mac OS X。我不明白。。。。假设您有一个名为“dir”的目录,其中包含4个文件:“a”、“b”、“c”和“d”,但只有“a”、“b”和“c”是可执行的,而“d”是可读的。现在您已经运行了“a”,并通过“bashd”执行了“d”。你

是否有可能使用ps命令列出当前目录中所有当前正在运行的进程?例如,我在同一目录中有a、b和c.exe(c程序)程序存储,我只想在终端上运行这三个进程时列出它们。

什么操作系统?我假设Linux(或基于Unix的东西),因为你说的是
ps
,但你说的是
c.exe
…我在使用Mac OS X。我不明白。。。。假设您有一个名为“dir”的目录,其中包含4个文件:“a”、“b”、“c”和“d”,但只有“a”、“b”和“c”是可执行的,而“d”是可读的。现在您已经运行了“a”,并通过“bashd”执行了“d”。你想看什么?所以我想我必须输入“ps-ef|grep pwd”?不,你必须在“`”之间使用pwd来执行它,然后value@A.ISSA试试这个:创建一个只包含一条指令的文件:“sleep60”。使此文件可执行(chmod 750)并在后台运行。现在运行上面建议的命令。你认为你会得到什么?你是对的,在这个cas中,我们可以使用:ps-ef | grep“sleep”
dir=`pwd`
ps -ef | grep "$dir"
# you can use pwd between "`", to execute it, and get value
ps -ef | grep "`pwd`"