Is there a way to configure bash to always page output?
I'd like to configure bash to page the output of all commands. Essentially, I want bash to behave as if every command I enter ended with '| less'. Is this possible?
You could do this:
$ bind '"\C-j": "|less\C-m"'
Or put this in your ~/.inputrc
:
"\C-j": "|less\C-m"
Then when you want to do ls -l|less
you'd type ls -l
and press control-J
instead of <enter>
.
I would not recommend swapping the j and m in the bind command (or in the .inputrc file). Every time you'd press <enter>
you'd get |less
added which could be pretty annoying.
I'm not sure if this is possible, but you can definitely make it easier on yourself by doing something like this in your .bashrc:
alias p='less'
ll |p
then becomes a paged listing.
EDIT: As a note though this still wont work for something that is going to STDERR. You would need to something like: errorcommand 2>&1 |p