Let us say in the interactive subshell I run these commands:

  • command_a
  • command-b
  • command_c
  • ...
  • command_z

I type M-p to go back to command_z.
But how can I scroll back the history of commands until I land on command_j, for example?

1 Answer 1


For cycling the command history in Shell use: M-n and M-p

have a look at Gnu Emacs Manual for the Shell ring

  • I landed on that page before asking, but I guess I am not smart :) Thank you for the help. Apr 16, 2018 at 5:29
  • 1
    emacs documentation requires getting used to. It is very minimal yet concise. You are welcome! Apr 16, 2018 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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