Ubuntu Terminal: How to Pause ls Listing CodeUnit 17 AUG 2011

To list the files and folders of a directory while running around in an Ubuntu terminal you use of course the classic ls list command. But what if the list it returns is particularly long? Is there a way to pause a ls listing so that you can follow what is going on?

The easiest way to achieve this is by piping the results of the ls command through to the classic more or newer less command. In practice:

ls -lh | less

Now the ls command will begin scrolling through all the files and folders in the selected directory until the page fills. From this point you can use the up or down arrow to either scroll backwards or forwards, of the page up/page down keys to hurry things up a bit. Pressing q will quite the operation.


About Craig Lotter

Software developer, husband and dad to two young ladies. Writer behind An Exploring South African. I don't have time for myself any more.