This might be a very basic question but I couldn’t find it anywhere on the internet.
Lets assume I have a file named test with this code
echo hello
sleep 10
echo hello
sleep 10
echo hello
sleep 10
How would I go about killing that program through another terminal in my server?
3
Answers
By Pressing this, you can kill that program from your terminal.
And you can kill this program from your main terminal where you exicute this in first place.
I am assuming the file is test.sh
You can do:
This will show the processes:
now you can kill the process using the PID:
Your script filename is
test
.So, in another terminal, you can execute
ps aux | grep test
.Then you can get the PID of
test
, which is located at the second column.Then, execute
kill -9 <PID>
.