Discussion Locked

kill processes for linux

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What string of commands can perform a kill process for 8 files in a linux system with just 1 command?

5 replies

by jayanth

I suppose that you can use 'kill' command only to kill the process in the memory. You cannot kill a file. Could you please be more specific of your requirements so that I could help you.
You could also give the command
'kill -9 ' where is the process id or a running process. The '-9' option forcibly kills the process.

by cpfeiffe

I'm going to guess that you mean 8 different processes, not eight different files. If this is the case and you know the processes you can build a file that lists each process and then run a for loop to kill the processes. The loop would look like this:
for PROC in `cat filename`
do
kill -9 `ps -e |grep $PROC |awk '{print $1}'`
done

If you want you could make the loop a separate executable file and when you want to kill the processes just type the name of the file that has the loop in it.

I hope this is what you are looking for. If not, please be more specific in the question and I'll try to assist further.

This discussion is closed to new replies.