In a terminal, are there any shortcuts to jump to a previous/next prompt? Scrolling up and trying to find the start of a log slows down my workflow.

I'm using iTerm on OSX, but this should be applicable to any Unix terminals. A solution in Tmux would help as well.


Newest iTerm2 beta has a "shell integration" feature which offers such shortcut keys.

If you've installed it successfully, you see a small arrow in front of the prompts. Press Cmd + Shift + Up/Down to jump to the previous/next one. See the documentation for more cool stuff.

  • 1
    Any idea how to set it up with this feature? I've installed shell integration, but not sure what to do after that. – domi91c Sep 22 '15 at 2:45
  • 1
    If you've install it successfully, you see a small arrow in front of the prompts. Press Cmd+Shift+Up/Down to jump to the prev/next one. See iterm2.com/shell_integration.html for further cool stuff. – egmont Sep 22 '15 at 8:01

"history" piped to "grep" gives you past inputs without the output. But you then have to copy and paste to use it. Once you've reused something this way, up-arrow for previous, works.


In tmux, you can enter copy-mode (bound to [ by default). From there you can do a reverse search with Ctrl-r in emacs-mode or ? in vi-mode. Tmux will ask you for a search term. If your prompt has a unique string to search for, it should be pretty easy to find. While still in copy-mode, you can use n to repeat the search.

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.