The F4 key replays the previous commands in reverse order (i.e., most recent to least recent).
The F5 key, on the other hand, replays the previous commands in forward order.