LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Output ls one screen at a time (https://www.linuxquestions.org/questions/linux-newbie-8/output-ls-one-screen-at-a-time-398875/)

anjanesh 01-02-2006 11:35 PM

Output ls one screen at a time
 
Whats the Linux equivalent of DIR | MORE ?
Googling Linux DIR | MORE is returning something else.

Thanks

Wim Sturkenboom 01-02-2006 11:52 PM

Code:

ls |more
ls |less

The second one allows you to scroll forward and backward

anjanesh 01-03-2006 12:03 AM

Thanks. And whats the Windows equivalent of CTRL + C ?I want to break in the middle but ESC or CTRL + C isnt doing the job. Using Putty though.

And finally then the list is over, it shows (END) highlighted. How do I resume back to shell ?

jrdioko 01-03-2006 12:38 AM

Ctrl-C is that command in Linux as well, not sure how it works over FTP. If you can open multiple sessions, you can use "killall <programname>" or "ps" to list processes and their PIDs and then "kill <PID>" to kill it that way.

When piping something to less (remember, less is more than more :)), you just press "q" at the end to get out (type "h" to get info on all available options).

anjanesh 01-03-2006 01:34 AM

Say I enter ls -l
There are 1000's of files in that directory so it'll take a long time to list. I want to break in the middle of it - just like the way we do in Windows - CTRL + C. But thats not working in Putty

Poetics 01-03-2006 01:51 AM

I doubt puTTY can interpret the Ctrl character, and so it can't be passed onto the tunneled computer.

Something tells me that wouldn't work regardless of the OS at the other end, being a limitation of puTTY.

There should be a way to limit the output to, say, 500 entries or whatnot. Off the top of my head I can't think of how, but I'm sure someone more experienced can help you in that regard.

jrdioko 01-03-2006 01:51 AM

Ctrl-C should work in Linux, I'm guessing FTP is set up in a way where that won't work for some reason. I'd suggest "ls -l | less" and scrolling down to the part you want. Type "h" to see all the options, you can go to a line number, search for words, etc. to find the section you need. Or if you just want the first certain number of lines look at "head -n"

anjanesh 01-03-2006 02:04 AM

Quote:

I'm guessing FTP is set up in a way where that won't work for some reason.
- Using SSH.
And even I do type ls -l | less, the problem is, I still cant get out of it in the middle - and even worse - when ls -l | less is over, it displays a highlighted (END) from which Im unable to get out - I had to close Putty altogether.

What do you guys use for remote accessing of a Linux Server ?
Would it be far more easier, better if I have a Linux PC to access my remote Linux Server ?

Thanks

cs-cam 01-03-2006 02:45 AM

He said it before, press 'q'.

anjanesh 01-03-2006 03:18 AM

Ah..thanks..q does work for ls | more and ls | less but not just for ls.

timmeke 01-03-2006 04:50 AM

Of course not, since "ls" just prints everything in one go. It doesn't put any pauses in the middle, so you
can't interrupt it (unless with Ctrl-C, but that may not work with PuTTY, as has been said earlier).

ls|more and ls|less actually take the output of "ls" and feeds that as input to "more" or "less" (same way
as on Windows). "more" and "less" then print the lines, but with pauses after each page. During such a pause,
you can jump out with "q".


All times are GMT -5. The time now is 07:41 AM.