Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
e86c6f5e
Unverified
Commit
e86c6f5e
authored
Nov 09, 2021
by
Kevin Burke
Committed by
GitHub
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: use `-n` flag in `head` and `tail` commands (#10391)
Co-authored-by:
Marc Cornellà
<
hello@mcornella.com
>
parent
55682e36
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
15 deletions
+15
-15
diagnostics.zsh
lib/diagnostics.zsh
+1
-1
directories.zsh
lib/directories.zsh
+1
-1
functions.zsh
lib/functions.zsh
+2
-2
git.zsh
lib/git.zsh
+1
-1
scd
plugins/scd/scd
+1
-1
README.md
plugins/systemadmin/README.md
+2
-2
systemadmin.plugin.zsh
plugins/systemadmin/systemadmin.plugin.zsh
+6
-6
install.sh
tools/install.sh
+1
-1
No files found.
lib/diagnostics.zsh
View file @
e86c6f5e
...
...
@@ -335,7 +335,7 @@ function _omz_diag_dump_os_specific_version() {
builtin echo
"OS Version:
$osname
$osver
build
$(
sw_vers
-buildVersion
)
"
;;
cygwin
)
command
systeminfo |
command head
-
4
|
command tail
-
2
command
systeminfo |
command head
-
n
4 |
command tail
-n
2
;;
esac
...
...
lib/directories.zsh
View file @
e86c6f5e
...
...
@@ -26,7 +26,7 @@ function d () {
if
[[
-n
$1
]]
;
then
dirs
"
$@
"
else
dirs
-v
|
head
-10
dirs
-v
|
head
-
n
10
fi
}
compdef _dirs d
...
...
lib/functions.zsh
View file @
e86c6f5e
function
zsh_stats
()
{
fc
-l
1
\
|
awk
'{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }'
\
|
grep
-v
"./"
|
sort
-nr
|
head
-20
| column
-c3
-s
" "
-t
|
nl
|
grep
-v
"./"
|
sort
-nr
|
head
-
n
20 | column
-c3
-s
" "
-t
|
nl
}
function
uninstall_oh_my_zsh
()
{
...
...
@@ -45,7 +45,7 @@ function takeurl() {
data
=
"
$(
mktemp
)
"
curl
-L
"
$1
"
>
"
$data
"
tar
xf
"
$data
"
thedir
=
"
$(
tar
tf
"
$data
"
|
head
-1
)
"
thedir
=
"
$(
tar
tf
"
$data
"
|
head
-
n
1
)
"
rm
"
$data
"
cd
"
$thedir
"
}
...
...
lib/git.zsh
View file @
e86c6f5e
...
...
@@ -51,7 +51,7 @@ function parse_git_dirty() {
FLAGS+
=
"--ignore-submodules=
${
GIT_STATUS_IGNORE_SUBMODULES
:-
dirty
}
"
;;
esac
STATUS
=
$(
__git_prompt_git status
${
FLAGS
}
2> /dev/null |
tail
-1
)
STATUS
=
$(
__git_prompt_git status
${
FLAGS
}
2> /dev/null |
tail
-
n
1
)
fi
if
[[
-n
$STATUS
]]
;
then
echo
"
$ZSH_THEME_GIT_PROMPT_DIRTY
"
...
...
plugins/scd/scd
View file @
e86c6f5e
...
...
@@ -270,7 +270,7 @@ fi
# Determine the last recorded directory
if
[[
-s
${
SCD_HISTFILE
}
]]
;
then
last_directory
=
${
"
$(
tail
-1
${
SCD_HISTFILE
})
"
#*;
}
last_directory
=
${
"
$(
tail
-
n
1
${
SCD_HISTFILE
})
"
#*;
}
fi
# The "record" function adds its arguments to the directory index.
...
...
plugins/systemadmin/README.md
View file @
e86c6f5e
...
...
@@ -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
...
...
plugins/systemadmin/systemadmin.plugin.zsh
View file @
e86c6f5e
...
...
@@ -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'
alias
psmem10
=
'ps -e -orss=,args= | sort -b -k1 -nr | head -
n
10'
# get top process eating cpu if not work try excute : 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
awk
'($NF > 60 && $7~/\.php/){print $7}'
"
$(
retlog
)
"
|sort
-n
|uniq
-c
|sort
-nr
|head
-
n
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 '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -
n
100
}
# Website traffic statistics (G)
...
...
tools/install.sh
View file @
e86c6f5e
...
...
@@ -311,7 +311,7 @@ EOF
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
if
!
zsh
=
$(
command
-v
zsh
)
||
!
grep
-qx
"
$zsh
"
"
$shells_file
"
;
then
if
!
zsh
=
$(
grep
'^/.*/zsh$'
"
$shells_file
"
|
tail
-1
)
||
[
!
-f
"
$zsh
"
]
;
then
if
!
zsh
=
$(
grep
'^/.*/zsh$'
"
$shells_file
"
|
tail
-
n
1
)
||
[
!
-f
"
$zsh
"
]
;
then
fmt_error
"no zsh binary found or not present in '
$shells_file
'"
fmt_error
"change your default shell manually."
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment