mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-27 03:05:39 +01:00
My custom files
This commit is contained in:
parent
affff9e09d
commit
ada37d13d5
8 changed files with 274 additions and 0 deletions
37
custom/functions.zsh
Executable file
37
custom/functions.zsh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#### Search for a running process
|
||||
pg() {
|
||||
emulate -L zsh
|
||||
unsetopt KSH_ARRAYS
|
||||
if [[ -z "$1" ]] ; then
|
||||
echo "any - grep for process(es) by keyword" >&2
|
||||
echo "Usage: any " >&2 ; return 1
|
||||
else
|
||||
ps xauwww | grep -i --color=auto "[${1[1]}]${1[2,-1]}"
|
||||
fi
|
||||
}
|
||||
|
||||
#### Beautiful PATH
|
||||
path() {
|
||||
echo $PATH | tr ":" "\n" | \
|
||||
awk "{ sub(\"/usr\", \"$fg_no_bold[green]/usr$reset_color\"); \
|
||||
sub(\"/bin\", \"$fg_no_bold[blue]/bin$reset_color\"); \
|
||||
sub(\"/opt\", \"$fg_no_bold[cyan]/opt$reset_color\"); \
|
||||
sub(\"/sbin\", \"$fg_no_bold[magenta]/sbin$reset_color\"); \
|
||||
sub(\"/local\", \"$fg_no_bold[yellow]/local$reset_color\"); \
|
||||
print }"
|
||||
}
|
||||
|
||||
#### All interface ips
|
||||
function myip() {
|
||||
ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}'
|
||||
ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
|
||||
ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
|
||||
ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
|
||||
ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# nice mount (http://catonmat.net/blog/another-ten-one-liners-from-commandlingfu-explained)
|
||||
# displays mounted drive information in a nicely formatted manner
|
||||
# -------------------------------------------------------------------
|
||||
function nicemount() { (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2="";1') | column -t ; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue