Когда я бегу на top
в Cygwin, я получаю:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
Я хотел бы извлечь эти столбцы для всех процессов:
PID PPID S COMMAND
ps
дает PID, PPID и COMMAND, но как мне получить столбец 'S' для всех процессов?
Редактировать:
Я не могу использовать то, что я использую в GNU/Linux:
$ ps -e -o pid,ppid,state,comm
ps: unknown option -- o
Try `ps --help' for more information.
$ ps --version
ps (cygwin) 1.7.33
Show process statistics
Copyright (C) 1996 - 2014 Red Hat, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ps --help
Usage: ps [-aefls] [-u UID] [-p PID]
Report process status
-a, --all show processes of all users
-e, --everyone show processes of all users
-f, --full show process uids, ppids
-h, --help output usage information and exit
-l, --long show process uids, ppids, pgids, winpids
-p, --process show information for specified PID
-s, --summary show process summary
-u, --user list processes owned by UID
-V, --version output version information and exit
-W, --windows show windows as well as cygwin processes
With no options, ps outputs the long format by default
procps
:
version: 3.2.8-3