How to stop displaying long long file list of `ls`?

Freewind picture Freewind · Sep 9, 2013 · Viewed 17.9k times · Source

There is a big directory which contains 100k files on the remote server, and I typed command: ls in my putty.

It starts to display a very long file list, and seems never end.

How to stop it, without closing the putty program?

Answer

rakib_ picture rakib_ · Sep 9, 2013

You can control the ls output by using less or more command, like below:

ls | more
ls | less

They'll work on interactive way. Or you can truncate output with head or tail command, like:

ls | head
ls | tail

head will show default 10 lines from head and tail will show default 10 lines from tail.