MacOS – Keyboard shortcut for stopping and restarting a command line application

command linemacosterminal

To stop and restart a Rails application that's running on the command line, I usually do Control + C, and then use the up arrow to get the previous command for running bin/rails s.

Is there a keyboard shortcut like Control + C that tells the application to stop, and start up again anew?

I'm currently using Terminal.

Best Answer

You mean in a single keystroke? No.

Depending on whether the daemon supports restarting itself/reloading its configuration, you might be able to restart it with a HUP, e.g.

sudo killall -HUP httpd

but A. that's not a keystroke, and B. it requires the daemon to have code to support doing that.