You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
13 years ago
|
#
|
||
|
# Defines utility functions.
|
||
|
#
|
||
|
# Authors:
|
||
|
# Robby Russell <robby@planetargon.com>
|
||
|
# Suraj N. Kurapati <sunaku@gmail.com>
|
||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||
|
#
|
||
|
|
||
13 years ago
|
# Serves a directory via HTTP.
|
||
|
alias http-serve='python -m SimpleHTTPServer'
|
||
15 years ago
|
|
||
14 years ago
|
# Makes a directory and changes to it.
|
||
13 years ago
|
function mkdcd {
|
||
13 years ago
|
[[ -n "$1" ]] && mkdir -p "$1" && cd "$1"
|
||
15 years ago
|
}
|
||
14 years ago
|
compdef _mkdir mkdcd
|
||
14 years ago
|
|
||
14 years ago
|
# Changes to a directory and lists its contents.
|
||
13 years ago
|
function cdll {
|
||
13 years ago
|
builtin cd "$1" && ll
|
||
14 years ago
|
}
|
||
14 years ago
|
compdef _cd cdll
|
||
14 years ago
|
|
||
14 years ago
|
# Pushes an entry onto the directory stack and lists its contents.
|
||
13 years ago
|
function pushdll {
|
||
13 years ago
|
builtin pushd "$1" && ll
|
||
14 years ago
|
}
|
||
14 years ago
|
compdef _cd pushdll
|
||
14 years ago
|
|
||
14 years ago
|
# Pops an entry off the directory stack and lists its contents.
|
||
13 years ago
|
function popdll {
|
||
13 years ago
|
builtin popd "$1" && ll
|
||
14 years ago
|
}
|
||
14 years ago
|
compdef _cd popdll
|
||
14 years ago
|
|
||
14 years ago
|
# Prints columns 1 2 3 ... n.
|
||
13 years ago
|
function slit {
|
||
13 years ago
|
awk "{ print $(for n; do print -n "\$$n,"; done | sed 's/,$//') }"
|
||
14 years ago
|
}
|
||
|
|
||
|
# Displays user owned process status.
|
||
13 years ago
|
function pmine {
|
||
13 years ago
|
ps "$@" -U "$USER" -o pid,%cpu,%mem,command
|
||
14 years ago
|
}
|
||
14 years ago
|
compdef _ps pmine
|
||
14 years ago
|
|
||
14 years ago
|
# Finds files and executes a command on them.
|
||
13 years ago
|
function find-exec {
|
||
14 years ago
|
find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \;
|
||
14 years ago
|
}
|
||
|
|