To stop creating vim processes, you must stop the for loop. This loop is controlled by the bash process. Therefore, find the PID of the process and kill it. To do this, find the PPID of the vim process, which is the PID of its parent process, and end the parent process: ps -elf | tr -s ' ' | grep vim | cut -f5 -d ' ' | xargs kill
ps -elf | tr -s ' ' | grep vim | cut -f5 -d ' ' | xargs kill
You can use this command with this second one, which will kill all vim processes to make sure that vim instances are not left: ps -elf | tr -s ' ' | grep vim | cut -f4 -d ' ' | xargs kill
ps -elf | tr -s ' ' | grep vim | cut -f4 -d ' ' | xargs kill
I see that you are having a "resolved permission" problem. This may be caused by a lack of permission, so to be sure that it will kill processes, you can invoke xargs kill with sudo: ps -elf | tr -s ' ' | grep vim | cut -f5 -d ' ' | sudo xargs kill
ps -elf | tr -s ' ' | grep vim | cut -f5 -d ' ' | sudo xargs kill
source share