1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-20 08:31:13 +00:00
prezto/utility.zsh
2012-01-23 20:40:57 -05:00

47 lines
1.1 KiB
Bash

# Lists the ten most used commands.
alias history-stat="history | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"
# Serves a directory via HTTP.
alias http-serve='python -m SimpleHTTPServer'
# Makes a directory and changes to it.
function mkdcd() {
[[ -n "$1" ]] && mkdir -p "$1" && cd "$1"
}
compdef _mkdir mkdcd
# Changes to a directory and lists its contents.
function cdll() {
builtin cd "$1" && ll
}
compdef _cd cdll
# Pushes an entry onto the directory stack and lists its contents.
function pushdll() {
builtin pushd "$1" && ll
}
compdef _cd pushdll
# Pops an entry off the directory stack and lists its contents.
function popdll() {
builtin popd "$1" && ll
}
compdef _cd popdll
# Prints columns 1 2 3 ... n.
function slit() {
awk "{ print $(for n; do print -n "\$$n,"; done | sed 's/,$//') }"
}
# Displays user owned process status.
function pmine() {
ps "$@" -U "$USER" -o pid,%cpu,%mem,command
}
compdef _ps pmine
# Finds files and executes a command on them.
function find-exec() {
find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \;
}