When using ls to view the contents of a large directory, how do you make the listing appear page at a time so you can view the entire listing and not just the last page? I searched the ls manual pages but had no luck there, I found no option that does this.
you can pipe to more
eg
ls -l |more
You Can also use 'pg' or 'less' with 'ls command'
ls -l | pg
ls -l | less
The less will help you scroll either backward or forward direction,by using <ctrl-b> or <ctrl-f>. whereas more is unidirectional ,less is bidirection paging.
Thanks. I thought maybe it could be done without a pipe.
In your shell init file (e.g., $HOME/.profile or $HOME/.bash_profile), put
l() { ls "$@" | less; }
Now, when you open a new shell, you will have a command, l, which does what you want.
Note that you might have to 'unalias l' if you have it defined (as some systems do).
Thanks for the detailed response.