What happened to the consoles?

Ralf Mardorf silver.bullet at zoho.com
Fri Mar 24 09:02:24 UTC 2017


On Fri, 24 Mar 2017 03:26:02 -0400, Tom H wrote:
>On Thu, Mar 23, 2017 at 8:01 PM, MR ZenWiz <mrzenwiz at gmail.com> wrote:
>> admar at marbase:~ $ psg system-logind
>> admar at marbase:~ $  
>
>So systemd-logind isn't running, unless "psg" isn't doing the right
>thing.

It's not good to use aliases on mailing lists, even wide spread aliases
such as "ll" aren't really "common" aliases.

If somebody isn't aware of systemctl and wants to use "ps" without
studying "ps" and how to write scripts, there are tools that are at
least "common" for Linux. In this case it's "pgrep".

# pgrep systemd-logind
405
# pgrep -l systemd-logind
405 systemd-logind
# pgrep -a systemd-logind
405 /usr/lib/systemd/systemd-logind

This should be installed by all Ubuntu flavour default installs, as
well as for each other major distro:

http://packages.ubuntu.com/yakkety/procps

Some distros might use the upstream name procps-ng and some
users might replace it with customized packages. On Arch I'm use an not
official package procps-ng-classic, to get the old "top" command.
However, "pgrep" is usually installed by default on most, if not all
Linux installs.

I suspect the OP does use

# psg() { if [ -z "$2" ]; then psargs="aux"; greparg="$1"; else psargs="$1"; greparg="$2"; fi; ps $psargs | grep -i "$(echo $greparg | sed -e 's/^\(.\)/[\1]/')\|^$(ps $psargs | head -1)" ; }
# psg systemd-logind
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       405  0.0  0.0  44984  4964 ?        Ss   Mar22   0:00 /usr/lib/systemd/systemd-logind

This is at least what I found by a quick Internet research:

http://www.commandlinefu.com/commands/view/977/psg-ps-grep-function-if-you-dont-have-pgrep-or-dont-know-how-to-use-it

Regards,
Ralf





More information about the ubuntu-users mailing list