1.0.3 • Published 2 years ago

nv-cli-linux-psef v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-cli-linux-psef

  • nv-cli-linux-psef
  • simple cli tool, same as "ps -ef", just display pid/ppid in a tree format

install

  • npm install nv-cli-linux-psef -g

usage

    Usage: nv_cli_lnx_psef [options]
    Options:
        -l, --list                 list all pids OR cmds
        -d, --show_pid_only        only show PID
        -c, --show_cmd_only        only show CMD
        -p, --path                 show path of
        -i, --pid                  pid,default 0<show all>
        -h, --help                 usage

example

breif list

        # nv_cli_lnx_psef -l
        {
          '0': undefined,
          '1': '/lib/systemd/systemd',
          '2': '[kthreadd]',
          '4': '[kworker/0:0H]',
          '6': '[mm_percpu_wq]',
          '7': '[ksoftirqd/0]',
          '8': '[rcu_sched]',
          '9': '[rcu_bh]',
          '10': '[migration/0]',
          .....

tree

    # nv_cli_lnx_psef 
     
    @proc@ %HsafMUPO:1% {
        "row": [
            null,
            0,
            null,
            null,
            null,
            null,
            null,
            null
        ]
    } [
        @proc@
        ├── /lib/systemd/systemd : 1
        │   ├── ....... 
        │   ├── /usr/sbin/sshd : 1224
        │   │   ├── sshd: : 8423
        │   │   │   └── -bash : 8551
        │   │   ├── sshd: : 9135
        │   │   │   └── -bash : 9263
        │   │   ├── sshd: : 50116
        │   │   │   └── -bash : 50245
        │   │   │       ├── /usr/local/bin/node : 64017
        │   │   │       └── /usr/local/bin/node : 64718
        │   │   │           └── /bin/sh : 64725
        │   │   │               └── ps : 64726
        ......    
        │   ├── /lib/systemd/systemd : 1556
        │   │   └── (sd-pam) : 1562
        │   ├── vmhgfs-fuse : 1710
        │   ├── PM2 : 2269
        │   │   ├── bash : 2522
        │   │   │   └── ./frpc : 2523
        │   │   └── node : 9601
        │   │       ├── login : 9616
        │   │       │   └── -bash : 9699
        │   │       ├── login : 10149
        │   │       │   └── -bash : 10232
        │   │       ├── login : 10245
        │   │       │   └── -bash : 10328
        │   │       ├── login : 10357
        │   │       │   └── -bash : 10440
        │   │       ├── login : 10453
        │   │       │   └── -bash : 10536
        │   │       ├── login : 10575
        │   │       │   └── -bash : 10703
        │   │       │       └── sudo : 10715
        │   │       │           └── /bin/bash : 10716
        │   │       ├── login : 10724
        │   │       │   └── -bash : 10807
        │   │       │       └── sudo : 10819
        │   │       │           └── /bin/bash : 10820
        │   │       │               └── su : 21040
        │   │       │                   └── bash : 21041
        │   │       │                       └── su : 21053
        │   │       │                           └── bash : 21054
        ......
        │   ├── tmux : 6668
        │   │   ├── -bash : 6669
        │   │   ├── -bash : 6690
        │   │   ├── -bash : 6710
        │   │   ├── -bash : 6729
        │   │   ├── -bash : 6748
        │   │   ├── -bash : 6767
        │   │   ├── -bash : 6789
        │   │   ├── -bash : 6808
        │   │   │   └── top : 6827
        │   │   ├── -bash : 6878
        │   │   ├── -bash : 6897
        │   │   ├── -bash : 6918
        │   │   └── -bash : 6937
        │   ├── /usr/sbin/cron : 17385
        │   └── /usr/lib/snapd/snapd : 49065
        └── [kthreadd] : 2
            ├── [kworker/0:0H] : 4
             ....... 
    ]

pid tree -d

    # nv_cli_lnx_psef -d -i 1224
    
    1224 %LhdEaxqd:26% {
        "row": [
            "root",
            1224,
            1,
            0,
            "May07",
            "?",
            "00:00:09",
            "/usr/sbin/sshd"
        ]
    } [
        1224
        ├── 8423
        │   └── 8551
        ├── 9135
        │   └── 9263
        ├── 50116
        │   └── 50245
        │       ├── 64017
        │       └── 64728
        │           └── 64735
        │               └── 64736
        ├── 55052
        │   └── 55182
        │       └── 61829
        ├── 55490
        │   └── 55572
        ├── 100111
        │   └── 100241
        └── 127815
            └── 127944
    ]

cmd tree -c

    # nv_cli_lnx_psef -c -i 1224
    
    /usr/sbin/sshd %WjgLcgVY:26% {
        "row": [
            "root",
            1224,
            1,
            0,
            "May07",
            "?",
            "00:00:09",
            "/usr/sbin/sshd"
        ]
    } [
        /usr/sbin/sshd
        ├── sshd:
        │   └── -bash
        ├── sshd:
        │   └── -bash
        ├── sshd:
        │   └── -bash
        │       ├── /usr/local/bin/node
        │       └── /usr/local/bin/node
        │           └── /bin/sh
        │               └── ps
        ├── sshd:
        │   └── -bash
        │       └── /usr/local/bin/node
        ├── sshd:
        │   └── -bash
        ├── sshd:
        │   └── -bash
        └── sshd:
            └── -bash
    ]

ances -p

    # nv_cli_lnx_psef -p -c -i 1224
    [ undefined, '/lib/systemd/systemd', '/usr/sbin/sshd' ]
    
    # nv_cli_lnx_psef -p -d -i 1224
    [ 0, 1, 1224 ]
    
    # nv_cli_lnx_psef -p -i 1224
    [ 0, 1, 1224 ]
    [ undefined, '/lib/systemd/systemd', '/usr/sbin/sshd' ]

METHODS

    x.ProcNode.prototype.$disable_repr
    x.ProcNode.prototype.$enable_repr
    x.ProcNode.prototype.$is_repr_enabled
    x.ProcNode.prototype.$tag_
    x.ProcNode.prototype.cmd_ances_
    x.ProcNode.prototype.cmd_plances_
    x.ProcNode.prototype.dict
    x.ProcNode.prototype.mode_
    x.ProcNode.prototype.pid_ances_
    x.ProcNode.prototype.pid_plances_
    x.ProcNode.prototype.show_both
    x.ProcNode.prototype.show_only_cmd
    x.ProcNode.prototype.show_only_pid

APIS

    > x
    {
      ProcNode: [class ‌ extends ‌] { CMD_PID_SP: ' : ' },
      sshow: [Function: sshow],
      ashow: [AsyncFunction: ashow]
    }
    >

LICENSE

  • ISC