In zsh, you can easily rerun previous commands from your command history using the following methods:

1. Using the Arrow Keys
Up Arrow Key: Press the ? (up arrow) key to scroll back through your command history. Each press will take you to the previous command.
Down Arrow Key: Press the ? (down arrow) key to scroll forward through the command history.
2. Using history Command
You can type history to display a list of previously executed commands. Each command will have a corresponding number.
To rerun a command, type ! followed by the command number. For example, if the command is listed as 42 in your history, you would type:
!42
3. Using fc
You can use the fc command to edit and rerun previous commands. By default, fc opens the last command in your default text editor (usually vi or nano):
fc
You can also specify a range, like this:
fc -l -10
This would list the last 10 commands. You can then edit the desired command and save it to run it.
4. Using Search
You can search through your command history interactively by pressing Ctrl + r. This will allow you to type part of a previous command, and it will show you the most recent match.
Keep pressing Ctrl + r to cycle through earlier matches. When you find the command you want, press Enter to run it.
5. Repeating the Last Command
To quickly repeat the last command you executed, simply type:
!!
This will execute the most recent command in the history.
Summary
These methods allow you to efficiently access and rerun previous commands in zsh, making it easier to work with your command line history.