diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md index 7847e15e9..f8266d8d4 100644 --- a/plugins/systemadmin/README.md +++ b/plugins/systemadmin/README.md @@ -19,6 +19,7 @@ plugins=(... systemadmin) | mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output | | psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory | | psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -n 10` | Display the top 10 processes using the most memory | +| pszombie| `ps -eo user,pid,ppid,state,comm \| awk '$4=="Z"'` | List zombie processes with ownership and parent process details | | pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU | | pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -n 10` | Display the top 10 processes using the most CPU | | hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history | @@ -48,5 +49,4 @@ plugins=(... systemadmin) | d0 | Delete 0 byte files recursively in the current directory or another if specified | | geteip | Gather information regarding an external IP address using [icanhazip.com](https://icanhazip.com) | | getip | Determine the local IP Address with `ip addr` or `ifconfig` | -| clrz | Clear zombie processes | | conssec | Show number of concurrent connections per second based on nginx/access.log file or another log file if specified | diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 331e80ab6..1d95a1ba8 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -28,6 +28,8 @@ alias mkdir='mkdir -pv' # get top process eating memory alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' +# list all zombie processes with ownership and parent process details +alias pszombie="ps -eo user,pid,ppid,state,comm | awk '\$4==\"Z\"'" # get top process eating cpu if not work try execute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr' alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr | head -n 10' @@ -177,11 +179,6 @@ function getip() { fi } -# Clear zombie processes -function clrz() { - ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 -} - # Second concurrent function conssec() { awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)" | sort -k 2 -nr | head -n10