Re: Basic ps Tips

Liste des GroupesRevenir à cu shell 
Sujet : Re: Basic ps Tips
De : mortonspam (at) *nospam* gmail.com (Ed Morton)
Groupes : comp.unix.shell
Date : 03. Aug 2024, 13:55:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8l5rk$3e995$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 8/3/2024 2:08 AM, Rene Kita wrote:
Jerry Peters <jerry@example.invalid> wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
[...]
     ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>
to report all the bash sessions I have running (quite a lot). The ???ww???
says not to truncate the output, which is handy for long command lines.
  Or just use ps -C <command>:
[...]
Does noone know about -C? I keep seeing things like 'ps -ef | grep
<something> in scripts to see if <something is running, rather than
using 'ps -C'.
 I did not know about it.
 The man page on OpenBSD does not mention -C, but calling 'ps -C' does
not give an error. But:
#v+
$ ps -C ksh
ps: /dev/mem: Permission denied'
#v-
 Dunno what to make out of it, but apparently one reason to use grep
instead of -C is portability.
Its described in the man page for FreeBSD ps, https://man.freebsd.org/cgi/man.cgi?ps(1), as:
        -C      Change  the  way the  CPU  percentage is calculated by using a
       "raw" CPU calculation that ignores "resident" time  (this  nor-
       mally has no effect).
so maybe you're running FreeBSD instead of the OpenBSD version.
Using `-C` to select a command isn't supported by POSIX, GNU, FreeBSD, OpenBSD, etc. so yes - portability would be a significant issue if you relied on it in your scripts.
     Ed.
 
         Jerry
Rene

Date Sujet#  Auteur
27 Jul 24 * Basic ps Tips22Lawrence D'Oliveiro
30 Jul 24 `* Re: Basic ps Tips21Lawrence D'Oliveiro
2 Aug 24  `* Re: Basic ps Tips20Jerry Peters
2 Aug 24   +- Re: Basic ps Tips1Lawrence D'Oliveiro
3 Aug 24   `* Re: Basic ps Tips18Rene Kita
3 Aug 24    +* Re: Basic ps Tips14Ed Morton
3 Aug 24    i`* Re: Basic ps Tips13Rene Kita
3 Aug 24    i +* Re: Basic ps Tips10Joerg Mertens
4 Aug 24    i i+* Re: Basic ps Tips7Rene Kita
4 Aug 24    i ii`* Re: Basic ps Tips6Joerg Mertens
5 Aug 24    i ii +* Re: Basic ps Tips4Lawrence D'Oliveiro
5 Aug 24    i ii i+* Re: Basic ps Tips2Joerg Mertens
5 Aug 24    i ii ii`- The whole point of the BSDs is to be retro (Was: Basic ps Tips)1Kenny McCormack
5 Aug 24    i ii i`- Re: Basic ps Tips1Christian Weisgerber
5 Aug 24    i ii `- Re: Basic ps Tips1Rene Kita
4 Aug 24    i i`* Re: Basic ps Tips2Christian Weisgerber
5 Aug 24    i i `- Re: Basic ps Tips1Rene Kita
3 Aug 24    i `* Re: Basic ps Tips2Lawrence D'Oliveiro
4 Aug 24    i  `- Re: Basic ps Tips1John D Groenveld
4 Aug 24    `* Re: Basic ps Tips3Christian Weisgerber
4 Aug 24     `* Re: Basic ps Tips2Christian Weisgerber
5 Aug 24      `- Re: Basic ps Tips1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal