Add ws function: web search
[khome.git] / home / lib / login_functions.sh
index 4ed67ba..ae4e98e 100644 (file)
@@ -1,5 +1,10 @@
 #
 
+## ws: web search
+ws() {
+    firefox --search "$*"
+}
+
 d() {
     local -r word=$(fzf < /usr/share/dict/words)
     dict "$word"
@@ -536,13 +541,11 @@ status() {
     echo
 
     printf '%smem by proc\n' "$indent_unit"
-    ps -eo rss,cmd \
+    ps -eo rss,comm \
     | awk -v total="$(free | awk '$1 == "Mem:" {print $2; exit}')" '
         NR > 1 {
             rss = $1
-            cmd = $2
-            n = split(cmd, path, "/")  # _may_ be a path
-            proc = path[n]
+            proc = $2
             by_proc[proc] += rss
         }
 
@@ -667,10 +670,10 @@ status() {
 
     echo "${indent_unit}<->"
 
-    printf '%sTCP' "${indent_unit}${indent_unit}"
+    printf '%sTCP\t' "${indent_unit}${indent_unit}"
     sudo -n netstat -tnp \
     | awk 'NR > 2 && $6 == "ESTABLISHED" {print $7}' \
-    | awk -F/ '{print $2}' \
+    | awk '{sub("^[0-9]+/", ""); print}' \
     | sort -u \
     | xargs \
     | column -t
This page took 0.025879 seconds and 4 git commands to generate.