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
0871594f
Commit
0871594f
authored
Oct 17, 2018
by
DBX12
Committed by
Marc Cornellà
Oct 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systemadmin: refactor plugin and fix README (#7295)
parent
ecb46c3e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
67 deletions
+49
-67
README.md
plugins/systemadmin/README.md
+39
-49
systemadmin.plugin.zsh
plugins/systemadmin/systemadmin.plugin.zsh
+10
-18
No files found.
plugins/systemadmin/README.md
View file @
0871594f
This diff is collapsed.
Click to expand it.
plugins/systemadmin/systemadmin.plugin.zsh
View file @
0871594f
...
@@ -12,14 +12,6 @@
...
@@ -12,14 +12,6 @@
#
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
function
retval
()
{
if
[[
-z
$1
]]
;
then
echo
'.'
else
echo
$1
fi
}
function
retlog
()
{
function
retlog
()
{
if
[[
-z
$1
]]
;
then
if
[[
-z
$1
]]
;
then
echo
'/var/log/nginx/access.log'
echo
'/var/log/nginx/access.log'
...
@@ -29,8 +21,8 @@ function retlog() {
...
@@ -29,8 +21,8 @@ function retlog() {
}
}
alias
ping
=
'ping -c 5'
alias
ping
=
'ping -c 5'
alias
clr
=
'clear;
echo "Currently logged in on $(tty), as $USER in directory $PWD."
'
alias
clr
=
'clear;
echo Currently logged in on $TTY, as $USER in directory $PWD.
'
alias
path
=
'
echo -e ${PATH//:/\\n}
'
alias
path
=
'
print -l $path
'
alias mkdir
=
'mkdir -pv'
alias mkdir
=
'mkdir -pv'
# get top process eating memory
# get top process eating memory
alias
psmem
=
'ps -e -orss=,args= | sort -b -k1,1n'
alias
psmem
=
'ps -e -orss=,args= | sort -b -k1,1n'
...
@@ -43,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
...
@@ -43,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# directory LS
# directory LS
dls
()
{
dls
()
{
ls
-l
|
grep
"^d"
|
awk
'{ print $9 }'
|
tr
-d
"/"
print
-l
*
(
/
)
}
}
psgrep
()
{
psgrep
()
{
ps aux |
grep
"
$
(
retval
$1
)
"
|
grep
-v
grep
ps aux |
grep
"
$
{
1
:-
.
}
"
|
grep
-v
grep
}
}
# Kills any process that matches a regexp passed to it
# Kills any process that matches a regexp passed to it
killit
()
{
killit
()
{
...
@@ -54,10 +46,10 @@ killit() {
...
@@ -54,10 +46,10 @@ killit() {
}
}
# list contents of directories in a tree-like format
# list contents of directories in a tree-like format
if
[
-z
"
\$
{which tree}"
]
;
then
if
!
((
$+
commands[tree]
))
;
then
tree
()
{
tree
()
{
find
$@
-print
|
sed
-e
's;[^/]*/;|____;g;s;____|; |;g'
find
$@
-print
|
sed
-e
's;[^/]*/;|____;g;s;____|; |;g'
}
}
fi
fi
# Sort connection state
# Sort connection state
...
@@ -97,7 +89,7 @@ syn20() {
...
@@ -97,7 +89,7 @@ syn20() {
# Printing process according to the port number
# Printing process according to the port number
port_pro
()
{
port_pro
()
{
netstat
-ntlp
|
grep
"
$
(
retval
$1
)
"
|
awk
'{print $7}'
|
cut
-d
/
-f1
netstat
-ntlp
|
grep
"
$
{
1
:-
.
}
"
|
awk
'{print $7}'
|
cut
-d
/
-f1
}
}
# top10 of gain access to the ip address
# top10 of gain access to the ip address
...
@@ -134,7 +126,7 @@ httpstatus() {
...
@@ -134,7 +126,7 @@ httpstatus() {
# Delete 0 byte file
# Delete 0 byte file
d0
()
{
d0
()
{
find
"
$
(
retval
$1
)
"
-type
f
-size
0
-exec
rm
-rf
{}
\;
find
"
$
{
1
:-
.
}
"
-type
f
-size
0
-exec
rm
-rf
{}
\;
}
}
# gather external ip address
# gather external ip address
...
...
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