LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to paginate in the 'LS' command? (https://www.linuxquestions.org/questions/linux-software-2/how-to-paginate-in-the-ls-command-201463/)

jhecht 07-05-2004 04:42 PM

How to paginate in the 'LS' command?
 
Ok - newbie here... But I can't seem to find any way to make the 'ls' command do a 'paginate' function. Like doing 'dir /p' in DOS. It's a way of viewing a large bunch of files a page (screen) at a time.

I know there's GOTTA be a way to do this - but I can't find it! I'm working from the Linux commandline to copy some files to floppy from the /etc folder. There are LOTS of files in /etc...

Why am I doing this? Because there's a problem with copying files to floppy from inside any GUI on my Linux box. I can only copy to floppy at the CLI right now. See my other posts for the details.

Thanks!

acid_kewpie 07-05-2004 04:45 PM

ls | less

jhecht 07-05-2004 06:25 PM

Uh, close. 'ls | less' gives a 1 line at a time display in a single column. Better than nothing.

But what I want is a multiple column display, that scrolls one screen at a time. Is that possible?

xamdbz01 07-05-2004 06:38 PM

try `ls -C | more`

jhecht 07-06-2004 07:23 AM

Tried that too. Gave me a single column of files that I could scroll down, same as the first command did.

XavierP 07-06-2004 07:26 AM

Try man ls - that will give you the options/switches to use with 'ls'.

camelrider 07-06-2004 02:13 PM

You could try ls -m | less

comp12345 07-06-2004 02:30 PM

Quote:

Originally posted by jhecht
Uh, close. 'ls | less' gives a 1 line at a time display in a single column. Better than nothing.

But what I want is a multiple column display, that scrolls one screen at a time. Is that possible?

I don't understand what's wrong with the choices being given to you. 'ls | less' works just like 'dir /p'. For multiple columns, use
Code:

ls -C | less
Use:

spacebar or pagedown - to scroll down one screen
pageup - to scroll up one screen
arrow keys - to move up and down the screen

'man less' for others.

xamdbz01 07-06-2004 03:26 PM

or you can try
Code:

ls -x | less

MaXM00D 04-13-2010 05:16 AM

I have the same trouble!
 
And none of your advices doesn't work... :cry:


UPD: IT WAS ONLY LONG FILE NAMES!!!!!!!!! me lol
:newbie: :banghead: :redface:

devnull10 04-13-2010 06:15 AM

The output from ls is slightly odd and it seems to depend on the number of files as to how it's treated. If you do ls -C in a large directory you may see multi-column output then you do ls -C > out.txt and it will be line by line. This is on AIX 5.1.


All times are GMT -5. The time now is 08:18 AM.