summaryrefslogtreecommitdiff
path: root/plugins/systemadmin
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2021-12-18 17:46:06 -0600
committerTuowen Zhao <ztuowen@gmail.com>2021-12-18 17:46:06 -0600
commit1bc186dabe12b3d01b2257e82f3a104c48b8b3c7 (patch)
tree54576312318c406b6ce2a35423198fcc92c8bf71 /plugins/systemadmin
parent2a977876c6e85847652f097cc128e4ed5bec147a (diff)
parent904f8685f75ff5dd3f544f8c6f2cabb8e5952e9a (diff)
downloadzsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.tar.gz
zsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.tar.bz2
zsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/systemadmin')
-rw-r--r--plugins/systemadmin/README.md4
-rw-r--r--plugins/systemadmin/systemadmin.plugin.zsh16
2 files changed, 10 insertions, 10 deletions
diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md
index 052fc6edc..146b58605 100644
--- a/plugins/systemadmin/README.md
+++ b/plugins/systemadmin/README.md
@@ -17,9 +17,9 @@ plugins=(... systemadmin)
| path | `print -l $path` | Displays PATH with each entry on a separate line |
| 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 -10` | Display the top 10 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 |
| 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 -10` | Display the top 10 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 |
## Functions
diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index a77f0069b..9a2129060 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -26,10 +26,10 @@ alias path='print -l $path'
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 -10'
-# get top process eating cpu if not work try excute : export LC_ALL='C'
+alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10'
+# 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 -10'
+alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10'
# top10 of the history
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
@@ -74,7 +74,7 @@ req20() {
# top20 of Using tcpdump port 80 access to view
http20() {
- sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20
+ sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20
}
# top20 of Find time_wait connection
@@ -99,14 +99,14 @@ accessip10() {
# top20 of Most Visited file or page
visitpage20() {
- awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20
+ awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20
}
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
consume100() {
- awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
- # if django website or other webiste make by no suffix language
- # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
+ awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
+ # if django website or other website make by no suffix language
+ # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
}
# Website traffic statistics (G)