0

I am working with ROS. And for starting ros-packages you need to have the ROS Master run in the background. Now when I want to start the ROS-package rviz, instead of opening two terminals: Terminal1:

$ roscore

Terminal2:

$ rviz

I can do the follwing in one Terminal:

$ roscore& rviz

But what exactly is happening here? Because when I end that terminal with Str+C it only closes rivz, but roscore is kept running in the background? Why and how can I close it?

Emilio7773
  • 187
  • 1
  • 9

1 Answers1

2

in case using single & the left side will run in the background, while the right side will run normally in the terminal.

Now to close the first process you need to find PID (Process ID) and do the termination command, so first of all you need to find PID and you can use pgrep (in your case PROCESS_NAME can be roscore):

pgrep -f PROCESS_NAME 

Now to kill the process you can easily do:

kill -9 PID_HERE

Or you can do it by single command:

pgrep -f PROCESS_NAME | xargs kill -9
ikoujar
  • 214
  • 1
  • 6