Stop Running .sh File in Linux

To stop the execution of a sh file, you can press Ctrl+C to interrupt the current process running. Open the terminal, locate the process of the running sh file, and then press the Ctrl+C key combination to stop it. If the sh file has started a background process, you can use the ps command to find the process ID, and then use the kill command to terminate that process. For example:

  1. 查找正在运行的sh文件的进程ID,使用ps命令。
ps aux | grep script.sh
  1. Terminate the process using the kill command.
kill -9 <进程ID>

This will stop the execution of the sh file.

bannerAds