Let's say I run a command like ls in fish and get lots of output, how do I scroll through it and still keep the fish formatting or something like it?

ls | less doesn't keep the formatting.

I know now that the coloring is due to ls being run as ls -G. ls -G produces the same coloring on the default shell on OSX. This suggests that maybe the question is about ls and not about fish.

On Arch, ls -C --color=always | less -R does it.

  • I'm not able to check just no. I suspect you'd need ls --color=always and then an option for less to interpret the color sequences – glenn jackman Aug 3 '15 at 16:03

Yes, it's because of BSD ls, not fish. There's no --color=always, you have to export CLICOLOR_FORCE.

So something like

alias lsless="set -gx CLICOLOR_FORCE ''; ls | less; set -e CLICOLOR_FORCE" would do it.

Another option would be to just brew install coreutils and then gls --color=always | less

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.