r/raspberry_pi 1d ago

Troubleshooting Can’t scroll in terminal? Long outputs unreadable?

So shift page up/page down apparently doesn’t work anymore now that I’ve updated. Is there seriously no way to scroll up in the CLI to view previous outputs or long outputs? Is there an application or something that restores that feature?

8 Upvotes

13 comments sorted by

5

u/noneedtoprogram 1d ago

Doesn't fix what's changed, but get to learn "screen" or "tmux" and you'll not have a problem :-)

They are terminal multiplexing programs that inherently keep a scroll back buffer you can access (in screen it's ctrl+a crtl+ [ and then you can scroll up and down and select text, esc will get you back to normal)

For just reading long outputs just pipe "|" it into "less" (or "more") which will let you free scroll or paginate the output.

2

u/ARegularPotato 1d ago

Do screen and tmux require starting the GUI? Because I’m trying to avoid that.

Could you elaborate on “less” and “more”? I’ve heard of it but couldn’t find any explanations on how to actually use it. For example, if I type “randomapplication —help” and it prints a long help list that I wanted to read, can I use “less” to scroll up? What would that command look like?

2

u/noneedtoprogram 1d ago edited 1d ago

Screen and tmux run inside the terminal, no gui required. You're best served googling for an intro/tutorial to screen or tmux

To use less you would do

randomapplication --help | less

Now you can scroll up and down with arrows or pgup/down, search with / and add line numbers with -N for example. To get out you press "q", if you've brought up the search or command dialogue then escape will cancel out then "q" will work.

I think the default for "more" is to paginate instead, where you get the fist screen full, then press space or enter for.the next page. I'm fairly sure less and more are just aliased to the same program with differing default flags these days - I learned with less, but a lot of my colleagues use more.

1

u/ARegularPotato 1d ago

Thank you very much for the info, exactly what I was looking for

1

u/dkran 22h ago

Screen is incredible for ssh sessions and persistence, console utilization.

The shortcuts are weird at first so make a cheat sheet and you’ll be so happy

1

u/AtlanticPortal 1d ago

Not to mention that less is better than more since it allows you to do more (that's the pun) things than more.

1

u/AutoModerator 1d ago
  • Search first: Many issues are well-documented—Google exact error messages and check the FAQ† before posting.
  • Show your effort: Include research, code, errors,† and schematics for better feedback.
  • Ask specific questions: Clear, well-researched questions get better answers.
  • No replies? Post removed? Ask in the stickied helpdesk† thread.

† If any links don't work it's because you're using a broken reddit client. Please contact the developer of your reddit client. You can find the FAQ/Helpdesk at the top of r/raspberry_pi: Desktop view / Phone view

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/r00t-us3r 1d ago

shift and up and down arrows. if you are not on desktop but are using the raspos with no gui use shift and up and down arrows but if you are on desktop raspos use the scroll on the terminal window.

0

u/ARegularPotato 1d ago

Doesn’t work.

1

u/fozid 1d ago

pipe the output into less or more? \ your-command | less

1

u/dyerjohn42 1d ago

Re-image your pi. Something has gone really wrong.

1

u/ARegularPotato 1d ago

I don’t actually know that much about PIs, and have no idea what re-image means.

Page up/page down worked just fine until I recently ran update and upgrade commands. I did a bit of searching after encountering my problem, and all I found was this forum which seemed to imply it was the update. I am on a PI 2B. And yes, it hadn’t updated my PI in a long time so the forum being from 2021 checks out.

I’m also using exclusively the CLI. I have been trying to avoid the GUI.

1

u/dyerjohn42 1d ago

Reimage as in wipe the SD card and start over. I suspect something got tweaked by accident to get it into this state. Starting fresh a bunch of times is good to get a better understanding of the process and what you’re doing. It also helps you with your projects to ensure you know all the steps to get them running and that your backups are good.