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.
 
 
 
 

69 lines
1.3 KiB

alias hg='history|grep'
alias hl='history|less -X'
hh() {
if [ -z "$1" ]; then
history 15
else
history $1
fi
}
alias watch-logs='sudo tail -F'
alias changed-files='find . -mtime -30 | less'
search() {
find . -name "$1" -print
}
match() {
if [ -z "$2" ]; then
echo "usage: match \"search_for_pattern\" file or files"
else
grep -n "$@" | less
fi
}
abc() {
if [ -n "$2" ]; then
_f_do_as "$1" sort "$1" | grep "$2"
else
_f_do_as "$1" sort "$1"
fi
}
short-asc() {
abc "$@" | head
}
alias short='sed 100q'
view-long() {
_f_do_as "$1" sed 500q $1 | less
}
save-long() {
if [ -n "$2" ]; then
_f_do_as "$1" sed 500q $1 > $2
else
echo "example: save-long in-file out-file"
fi
}
head-log() {
if [ -n "$2" ]; then
_f_do_as "$1" head -n 2000 $1 > $2
else
_f_do_as "$1" head -n 2000 $1 | less
fi
}
tail-log() {
if [ -n "$2" ]; then
_f_do_as "$1" tail -n 2000 $1 > $2
else
_f_do_as "$1" tail -n 2000 $1 | less
fi
}
logs-find-errors() {
_f_do_as "$1" grep -Rni "error" $@ | less
}
logs-find-notices() {
_f_do_as "$1" grep -Rni "notice" $@ | less
}
logs-find-warnings() {
_f_do_as "$1" grep -Rni "warning" $@ | less
}
logs-find-deprecated() {
_f_do_as "$1" grep -Rni "deprecated" $@ | less
}