I've got a program which has a lot of output. Once it's done I often want to scroll back to the begin of the run so that I can look at some things there. Since the output is so long though, I see myself endlessly scrolling with PageUp and trying to drag the scrollbar on the right to the point where it could have begun. Over a while this starts getting quite tiresome, so I wonder:
Is there a way to easily have the terminal scroll back to the part where the last command was given?
Open a terminal application on your Linux or Unix and type history to list all commands. To search for a command in the history, press ctrl+r multiple times. For instance, you can hit the ctrl+r and type string to search.
Type "cd -" in the Terminal window and press "Return." The Terminal returns to the previous directory.
Using a Reverse Search of Linux Command History To enter this mode you simply press ctrl and r. You can then enter a search term and use repeat presses of ctrl and r to step back through the list of previous commands containing that term.
Use Shift + Page Up and Shift + Page Down .
I have just found this in Terminal for OSX:
Edit > Navigate > Jump to Previous Mark: cmd + UP.
I use iTerm2
in macOS, I came up with a method. First, you should make sure you check the Unlimited scrollback
in iTerm2's preferences.
After you run a command in terminal and got a long long output.
Press Cmd
+F
(maybe ctrl
+F
in windows) then your can search in terminal like this:
Finally, just search your user name and press Enter
, generally speaking you will jump to the last command:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With