Quando executo top
no Cygwin, obtenho:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
Eu gostaria de extrair essas colunas para todos os processos:
PID PPID S COMMAND
ps
fornece PID, PPID e COMMAND, mas como obtenho a coluna 'S' para todos os processos?
Editar:
Eu não posso usar o que eu uso no 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