Stop a Running Command on macOS Terminal


If you are running a command or a script on the Mac Terminal and you want to know how to stop/terminate the execution and come back to your prompt then you can press Control + Z keys on your Mac keyboard.

Let's take an example where we ran a ping command, and want to stop it, just pressing Control + Z stops the execution as shown below.

Code2care@Mac % ping code2care.org

PING code2care.org (104.21.91.10): 56 data bytes
64 bytes from 104.21.91.10: icmp_seq=0 ttl=58 time=9.099 ms
...
64 bytes from 104.21.91.10: icmp_seq=4 ttl=58 time=15.527 ms
64 bytes from 104.21.91.10: icmp_seq=5 ttl=58 time=12.931 ms
^Z
zsh: suspended  ping code2care.org

The ^Z characters appear on the screen and the command got suspended.

Stop macOS Terminal Command
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author Info:

Rakesh (He/Him) is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap