Sample Header Ad - 728x90

Can you rescue a shell from an accidental "yes" command?

3 votes
1 answer
887 views
**Scenario**: I'm running a bunch of commands, some of which prompt for "yes/no" answers. I accidentally type yes as a *command* instead of as a response to a prompt. OOPS. Now my shell looks like this:
$ yum install -y something-important
... useful output I want to go back and refer to, perhaps multiple times
$ yes
y
y
y
y
y
y
y
y
y
y
y
... there are tens of thousands of lines... oh god, Y??
I successfully halt the yes command after realizing what happened, but the damage is already done. I was in the middle of an intense shell session, and now I've lost the ability to scroll back up for relevant output! Obviously the previous text is all still there, but it's essentially inaccessible because it's dwarfed by all the y. Something like clear will help remove the unsightly y torrent from my screen, but it won't help me get back to the previous session state. **How can I rescue this session's previous output to still be useful?**
Asked by Indigenuity (133 rep)
Jun 22, 2022, 09:15 PM
Last activity: Jun 23, 2022, 11:30 AM