Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all. Im working in Suse, and i have a process in C where i use the function "system" to call matlab. I have some problems with matlab, and i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    11

    kill a process


    Hi all.

    Im working in Suse, and i have a process in C where i use the function "system" to call matlab. I have some problems with matlab, and i need to know how to kill it automatically with another process that is monitoring the matlab.

    I think, that the easiest way is with the pid of matlab, and then kill the process by using the pid.

    How can i know the pid of matlab, in another process and then kill it? (I have to do this, automatically, running another process)

    Thanks for help.

  2. #2
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,104
    From a shell or script

    ps -A

    lists all processes.

    ps h -opid -C metlab

    should find the metlab process PID

    ps h -opid -C metlab | xargs kill

    should kill the process

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •