Open the Terminal app under macOS (⌘-space for Spotlight search is the quickest)

image

Enter the ssh command. Cursor keys and delete can be used to edit.

Once you’ve entered it once, up-arrow will let you go back in your history and return will re-execute the line. ctrl-r (^r) will also let you search through your history in the terminal window, so, for example ^rssh will likely bring it up again. ^r again will search back even further for things that match “ssh”.