As explained before, ROS provides a number of command-line tools for navigating through the filesystem. In this subsection, we will explain the most used ones, with examples.
To get information about the packages and stacks in our environment, such as their paths, dependencies, and so on, we can use rospack and rosstack. On the other hand, to move through packages and stacks, as well as listing their contents, we will use roscd and rosls.
For example, if you want to find the path of the turtlesim package, you can use the following command:
$ rospack find turtlesim
Which will then result in the following output:
/opt/ros/kinetic/share/turtlesim
The same thing happens with the metapackages that you have installed in the system. An example of this is as follows:
$ rosstack find ros_comm
You will obtain the path for the ros_comm metapackage as follows:
/opt/ros/kinetic/share/ros_comm
To list the files inside the pack or stack, you will use the following command:
$ rosls turtlesim
The following is the output of the preceding command:
cmake images srv package.xml msg
Changing the current working directory, essentially moving to a new folder, can be done with roscd as follows:
$ roscd turtlesim $ pwd
The new path will be as follows:
/opt/ros/kinetic/share/turtlesim