LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   "ls" option (https://www.linuxquestions.org/questions/linux-general-1/ls-option-50589/)

correro 03-19-2003 12:36 AM

"ls" option
 
What option should I use if I want to list contents of a directory page by page while not using the pipe " | more"?

I checked the man page of "ls", but didn't find the option I need.

MasterC 03-19-2003 12:59 AM

ls | less

Is that what you mean? Or you just want to append to ls with a -something rather? You don't wanna pipe it to anything? Hmmm... If that is the case I am not too sure, I usually pipe it to less.

Cool

correro 03-19-2003 01:28 AM

no, that's not what i mean.

certainly i can use "more" or "less", but if i do so, i lose the coloring.

what i'm looking for is an option for "ls" with which i can view contents of a directory page by page and still keep the different colors indicating directories or links or normal files.

acid_kewpie 03-19-2003 04:24 AM

Well that's not really and of ls's business, it's more down to the shell you are using. by default the newer versions of bash will automatically stop after each screenful of information, whatever program you are using. i can't remember the Xresource to set for it, but try upgrading bash, and i'll have a look what i get home as you may well be able to just turn it on without upgrading.

hopefully you can see why ls doesn't do this from the modularity of unix. ls's job is to show lists of files, not deal with terminal scrolling etc, so whilst old DOS dir can use /p it's a design hack and in the purest sense shouldn't be there.

NGene 03-19-2003 08:38 AM

One way to cope with this issue would be to use -F option with ls, like
ls -F | less

This way it puts different signs at the end of your file names, depending on what type they are. Then you'd be able to see the type of your files even though you don't get the colors.

Crashed_Again 03-19-2003 09:20 AM

or try:

ls -m

moses 03-19-2003 09:28 AM

ls --color | less -R

(man less)

correro 03-19-2003 07:44 PM

Print to Windows print server
 
How do I print to a Windows printer server?

Do I need to enable the local "lpd"?

rickenbacherus 03-21-2003 09:40 PM

Quote:

Originally posted by NGene
One way to cope with this issue would be to use -F option with ls, like
ls -F | less

This way it puts different signs at the end of your file names, depending on what type they are. Then you'd be able to see the type of your files even though you don't get the colors.

Exactly what I needed! -a workaround for being colorblind! :D Would it be possible to make that the default behavior?

cuckoopint 03-21-2003 10:13 PM

Quote:

Would it be possible to make that the default behavior?
make an alias in ~/.bashrc

Code:

alias ls = "ls -F | less"    #or whatever

rickenbacherus 03-21-2003 11:46 PM

Well that was easy now wasn't it. :)
Thank you cuckoopint.

doublefailure 03-22-2003 01:17 AM

moses, that's cool tip
thanks


All times are GMT -5. The time now is 09:33 PM.