--- a/stat.rst Mon Mar 24 21:12:19 2014 +0200
+++ b/stat.rst Tue Apr 01 19:05:48 2014 +0300
@@ -6,6 +6,93 @@
=========================
.. contents::
+Process list.
+=============
+
+Linux.
+------
+
+View current user process::
+
+ $ ps
+
+View all running process::
+
+ $ ps -e
+
+View process commands::
+
+ $ ps -e -o pid,cmd
+
+View detail process info::
+
+ $ ps -f <id>
+
+Kill process::
+
+ $ kill -s $SIG $PID
+
+View processes interactively::
+
+ $ htop
+
+Use ``-w``option for wide output. Use this option twice for unlimited width.
+
+Run as another user::
+
+ $ su - $user
+ $ command
+
+or::
+
+ $ sudo -u <user> -i <command>
+
+FreeBSD.
+--------
+
+View current user process::
+
+ $ ps
+
+View all running process::
+
+ $ ps -ax
+
+View detail process info::
+
+ $ ps -j <id>
+ $ ps -l <id>
+
+Windows.
+--------
+
+View all running process::
+
+ cmd> TaskList
+ Process Name PID Session Name #Session Memory
+ ========================= ====== ================ ======== ============
+ System Idle Process 0 Console 0 28 KB
+ System 4 Console 0 236 KB
+ smss.exe 592 Console 0 432 KB
+ csrss.exe 656 Console 0 4 404 KB
+ winlogon.exe 680 Console 0 2 792 KB
+ services.exe 724 Console 0 3 260 KB
+
+View processes interactively::
+
+ cmd> taskmgr
+
+Kill process (TODO with which Windows version come?)::
+
+ cmd> tskill {<pid>|<name>}
+
+ cmd> taskkill /IM notepad.exe
+ cmd> taskkill /PID 827
+
+Run as another user::
+
+ $ runas /u: TODO XXX
+
CPU consumption.
================