stat.rst
changeset 1570 e98df1173d31
parent 1558 beba45734051
child 1571 b833a33ae5b6
equal deleted inserted replaced
1569:650683205401 1570:e98df1173d31
     3 
     3 
     4 =========================
     4 =========================
     5  OS resource statistics.
     5  OS resource statistics.
     6 =========================
     6 =========================
     7 .. contents::
     7 .. contents::
       
     8 
       
     9 Process list.
       
    10 =============
       
    11 
       
    12 Linux.
       
    13 ------
       
    14 
       
    15 View current user process::
       
    16 
       
    17   $ ps
       
    18 
       
    19 View all running process::
       
    20 
       
    21   $ ps -e
       
    22 
       
    23 View process commands::
       
    24 
       
    25   $ ps -e -o pid,cmd
       
    26 
       
    27 View detail process info::
       
    28 
       
    29   $ ps -f <id>
       
    30 
       
    31 Kill process::
       
    32 
       
    33   $ kill -s $SIG $PID
       
    34 
       
    35 View processes interactively::
       
    36 
       
    37   $ htop
       
    38 
       
    39 Use ``-w``option for wide output. Use this option twice for unlimited width.
       
    40 
       
    41 Run as another user::
       
    42 
       
    43   $ su - $user
       
    44   $ command
       
    45 
       
    46 or::
       
    47 
       
    48   $ sudo -u <user> -i <command>
       
    49 
       
    50 FreeBSD.
       
    51 --------
       
    52 
       
    53 View current user process::
       
    54 
       
    55   $ ps
       
    56 
       
    57 View all running process::
       
    58 
       
    59   $ ps -ax
       
    60 
       
    61 View detail process info::
       
    62 
       
    63   $ ps -j <id>
       
    64   $ ps -l <id>
       
    65 
       
    66 Windows.
       
    67 --------
       
    68 
       
    69 View all running process::
       
    70 
       
    71   cmd> TaskList
       
    72   Process Name                 PID Session Name     #Session       Memory
       
    73   ========================= ====== ================ ======== ============
       
    74   System Idle Process            0 Console                 0        28 KB
       
    75   System                         4 Console                 0       236 KB
       
    76   smss.exe                     592 Console                 0       432 KB
       
    77   csrss.exe                    656 Console                 0     4 404 KB
       
    78   winlogon.exe                 680 Console                 0     2 792 KB
       
    79   services.exe                 724 Console                 0     3 260 KB
       
    80 
       
    81 View processes interactively::
       
    82 
       
    83   cmd> taskmgr
       
    84 
       
    85 Kill process (TODO with which Windows version come?)::
       
    86 
       
    87   cmd> tskill {<pid>|<name>}
       
    88 
       
    89   cmd> taskkill /IM notepad.exe
       
    90   cmd> taskkill /PID 827
       
    91 
       
    92 Run as another user::
       
    93 
       
    94   $ runas /u: TODO XXX
     8 
    95 
     9 CPU consumption.
    96 CPU consumption.
    10 ================
    97 ================
    11 
    98 
    12 Linux interactive.
    99 Linux interactive.