LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2004, 07:48 PM   #1
jungatheart
LQ Newbie
 
Registered: Apr 2004
Location: sunny southern california
Distribution: gentoo
Posts: 10

Rep: Reputation: 0
The most basic question this forum has ever seen


How do I limit the output from ls (or any program for that matter) so that I can read a bit of it, and then hit enter to have more scroll onscreen. I am often frustrated by ls giving me an output that is mostly unreachable.
 
Old 04-17-2004, 07:59 PM   #2
tristan
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Rep: Reputation: 0
I'm a newbie myself, but try "piping" it to less

ls *.sh | less
 
Old 04-17-2004, 08:04 PM   #3
Sathington
LQ Newbie
 
Registered: Mar 2004
Distribution: Slackware 9.1
Posts: 12

Rep: Reputation: 0
just do "ls |more"

or "ls -l |more"
whatever
 
Old 04-17-2004, 08:45 PM   #4
Muzzy
Member
 
Registered: Mar 2004
Location: Denmark
Distribution: Gentoo, Slackware
Posts: 333

Rep: Reputation: 30
You should also be able to use Ctrl+PageUp / Ctrl+PageDown to scroll the output so that you can go back and see things that you missed. If your console is an X window, then you will even have a scroll bar. This makes less / more unnecessary as you can happily scroll back to see anything you might have missed.
 
Old 04-17-2004, 08:46 PM   #5
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
For a more technical explanation:

With Linux shells (the command line environment) you can redirect the output from a command to somewhere else. This may be a file or another programme. Programmes can also take the input from a redirection, instead of (for example) the keyboard. So, for example, if you wanted to create a file whose contents were that of the command "ls" you'd do this:
Code:
$ ls > filename.txt
If you wanted to list the contents of a file, you could do this for example:
Code:
less < filename.txt
You can also do something in Linux that give real power: you can pipe things from one to another. So, for instance, you can take the output of ls and use it as the input for less in the examples above:
Code:
ls | less
.

The real power of this system becomes apparent when you have multiple things piped from one to another. An example that I can think of would be converting from one image type to another without using an image editor.
 
Old 04-17-2004, 10:23 PM   #6
vectordrake
Senior Member
 
Registered: Nov 2003
Location: NB,Canada
Distribution: Something alpha or beta, binary or source...
Posts: 2,280
Blog Entries: 4

Rep: Reputation: 47
yep. you have "less" "more" and "most" for sure. They all behave quite similarly. If you want output a page at a time, you should use these programs. Spacebar or pagedown make the next page appear and pageup makes it go back.
 
Old 04-18-2004, 02:57 AM   #7
jungatheart
LQ Newbie
 
Registered: Apr 2004
Location: sunny southern california
Distribution: gentoo
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks very much, everyone.
 
Old 04-18-2004, 12:34 PM   #8
denniz
Member
 
Registered: Apr 2004
Location: amsterdam
Distribution: Debian (Sarge and Woody)
Posts: 49

Rep: Reputation: 15
don't forget to use your arrows-keys
and if you've had enough of it, press q to return back to the command line
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A really basic question jimscafe Debian 14 01-09-2004 07:44 PM
Basic C++ question ooagentbender Programming 10 12-10-2003 10:34 PM
very basic question Louisa Linux - Newbie 4 08-31-2003 03:05 PM
Basic Questions to the Forum Herbertt Linux - Newbie 5 03-12-2003 02:16 PM
A really basic question pilotgi Linux - Newbie 10 10-14-2002 05:57 PM


All times are GMT -5. The time now is 07:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration