I'm familiarizing myself with the terminal, and trying to use the ls
command is the directory /usr/bin
.
Unfortunately, it doesn't show me everything in the folder, the terminal cuts it off.
How would I work around this?
If you run:
ls /usr/bin | less
Then the output of ls
will be piped to less
(a versatile pager), which lets you scroll up and down:
You can even search the text (below wherever you are in it) by pressing /, entering your search string, and pressing Enter.
To quit less
, press q. (If that doesn't work, such as when you're in the middle of entering a search string, just press Escape a couple times first.)
less
is an extremely handy tool. You can even keep your terminals the default 25 lines tall, if you like, read through multiple pages of output with just the keyboard, fully within the terminal, not having to rely on the features of your terminal emulator application at all.
Besides piping the output of a command to less (command | less
, as above), you can also use it to view files:
less filename
less
is also the default pager used by the man
command. man
is another very handy command, because it shows the manpages ("manual pages") for most commands, and some other topics. For example, to read the manual page for the less
command:
man less
What has happened here is the buffer Gnome Terminal gives you is limited to a number of lines.
less
(per Eliah's answer) is almost certainly the best option, especially as it allows you to search the content amongst other things... But you could also increase that buffer. You can make it unlimited if you like but that might mean it uses more RAM than you'd like:
(Yeah it looks all KDEy, but it really is Gnome Terminal)
ls -x
to make it show more columns BUT see the scrollbar to the right? if you pull it down it will show more. Besides that: open "profile preferences" see "scrolling" and increase the lines at "scrollback".ls /usr/bin | more
which will limit the display to one page at a time.