How to Display the Path to a ROS 2 Package

search-autumn-leaves

Let’s suppose you want to display the full path to a ROS 2 package so that you know which directory on your computer the package is located in.

For example, suppose you want to know where the rviz2 package is located.

Here is what you do…

Open a terminal window, and type:

ros2 pkg prefix rviz2

Here is what the output would look like in a terminal window:

ros2pkgprefix