Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAaron Coursolle
18,014 PointsIs there a way to display directories--one window at a time?
My computer's trackpad doesn't have the equivalent of a mouse wheel, so when a directory has a lot of entries I can't see them all. Is there a way to show the directory one window at time and if so what would I press to move on to the next window? Also, what would I press to get out and return to the default prompt once I've found the file/directory that I'm looking for (without viewing the rest of the files).
1 Answer
Iain Simmons
Treehouse Moderator 32,305 PointsYes, you can use a pipe and the more
or less
command after the ls
command used to list the directory contents:
ls | more
ls -alh | less
less
has more features (ironic huh?), like being able to search for a string, etc. It's similar to the commands you can use in the vi
text editor.
For both more
and less
, you can use enter to scroll down one line at time or space to scroll one page at a time. I think page up and down also work. Press q
to quit, (Ctrl + C
also works for more
).
Aaron Coursolle
18,014 PointsAaron Coursolle
18,014 PointsPage Up and Page Down didn't work for me, but it may be available if I was using a "real" console. Otherwise the information you provided was exactly what I was looking for. Thank you.