bash – Configure Bash to Always Page Output

bashpagingshell

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?

Best Answer

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.