5

I'm wonder if there is some way to list all files of a folder by ls, I know how to use ls for a folders which are small but if list of files doesn't match with the screen size what should I do? there is no scroll!

15

pipe it into more:

ls -la | more

Then down arrow scrolls to the next line, spacebar jumps a page at a time

| improve this answer | |
  • 7
    Use | less instead; as opposed to traditional "more", that will also allow you to scroll backwards, search forwards and backwards and so on. Press h for help, and remember that less is more (on some releases of some Linux distros, "more" may actually be "less" by another name, but don't rely on that). – Gabe Nov 29 '13 at 15:33
  • 4
    When listing directories and using a pager such as less, you might want to try some of the options to make your browsing easier/more informative. I'm partial to /bin/ls -alFv --color=always | /usr/bin/less -iXRS. The ls options mean (respectively) show hidden files, show extended info, show punctuation to identify special files, sort numbers naturally, and show colors to identify file types. The less options mean (respectively) ignore case when searching, don't clear screen when done, preserve colors from ls, and don't wrap long lines. – dg99 Nov 30 '13 at 1:00
4

more is good, less gives more scrolling options (up and down):

ls | less

If you want color:

ls --color=always | less -iXRS

Quit less as if it were vi, :q

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.