3 ms·
This lets you easily search your command history by typing the beginning of a command and pressing the up arrow. bind '"\e[A": history-search-backward'
by iwalton3 8y ago
This lets you easily search your command history by typing the beginning of a command and pressing the up arrow.
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
This one automatically lists the files in the current directory, but limits the number of lines.
function cd {
builtin cd "${@}"
if [[ "$(stat -c "%b" .)" -lt "100" ]]
then
if [ "$( ls -C -w $COLUMNS | wc -l )" -gt 30 ] ; then
ls -C -w $COLUMNS --color=always | awk 'NR < 16 { print }; NR == 16 { print " (... snip ...)" }; { buffer[NR % 14] = $0 } END { for( i = NR + 1; i <= NR+14; i++ ) print buffer[i % 14] }'
else
ls
fi
fi
}
- antoineMoPa 8y agoThe first one is pretty much CTRL+R (reverse incremental search)