aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-01-27 02:26:48 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-01-27 02:26:48 +0100
commitc649f69634104c80d5da8af20871646e7d06aab1 (patch)
tree127a7cba91ded30b105d18bd45d54a24d93d5128
parent4853f0d91ab52940d8857a812fabda42915a738e (diff)
downloadnotes-c649f69634104c80d5da8af20871646e7d06aab1.tar.gz
notes-c649f69634104c80d5da8af20871646e7d06aab1.zip
ps: add notes
-rw-r--r--src/SUMMARY.md1
-rw-r--r--src/monitor/README.md1
-rw-r--r--src/monitor/ps.md36
3 files changed, 38 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index d0e83ff..6c53882 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -27,6 +27,7 @@
- [ss](./monitor/ss.md)
- [pidstat](./monitor/pidstat.md)
- [pgrep](./monitor/pgrep.md)
+ - [ps](./monitor/ps.md)
- [pmap](./monitor/pmap.md)
- [pstack](./monitor/pstack.md)
diff --git a/src/monitor/README.md b/src/monitor/README.md
index baaacb9..4728b14 100644
--- a/src/monitor/README.md
+++ b/src/monitor/README.md
@@ -4,5 +4,6 @@
- [ss](./ss.md)
- [pidstat](./pidstat.md)
- [pgrep](./pgrep.md)
+- [ps](./ps.md)
- [pmap](./pmap.md)
- [pstack](./pstack.md)
diff --git a/src/monitor/ps.md b/src/monitor/ps.md
new file mode 100644
index 0000000..7e86678
--- /dev/null
+++ b/src/monitor/ps.md
@@ -0,0 +1,36 @@
+# ps(1)
+
+```
+ps [opt]
+ opt:
+ --no-header .... do not print column header
+ -o <OUT> ....... comma separated list of output columns
+ -p <PID> ....... only show pid
+ -T ............. list threads
+```
+> Set `PS_FORMAT` env variable to setup default output columns.
+
+Frequently used output columns
+```
+pid process id
+pgid process group id
+tid thread id
+
+comm name of process
+cmd name of process + args (full)
+
+etime elapsed time (since process started)
+user user owning process
+
+pcpu cpu utilization (percent)
+pmem physical resident set (rss) (percent)
+rss physical memory (in kb)
+vsz virtual memory (in kb)
+```
+
+## Example: Use output for scripting
+```sh
+for tid in $(ps -o tid --no-header -T -p 31084); do
+ taskset -c -p $tid;
+done
+```