I just tested what Carlos sent: idryanov@idryanov-desktop:~/ros/ros$ roscd rviz/ [rviz]:$ cd src/rviz/ [rviz/src/rviz]:$ cd / idryanov@idryanov-desktop:/$ I made another small tweak which fixes a bug when the name of the package is occurs twice in the directory path. So, without further ado, version 3 of the roscd hack: ########################################### # To enter ROSCD_MODE, type in roscd name_of_package # To exit ROSCD_MODE, type in roscd, or change to a directory outside # the package (`cd /`, `cd ..` etc) # If ROSCD_MODE is set, replaces the default bash prompt and tab title # with [name_of_package]. export PS1_BAK=$PS1 PROMPT_COMMAND=' if [ "$ROSCD_MODE" ]; then basedir="${PWD#${PWD%%/${ROSCD_MODE}*}}" if [ -z $basedir ]; then unset ROSCD_MODE export PS1=$PS1_BAK else export PS1="\[\e]0;[ ${ROSCD_MODE} ]\a\]\[\e[31;1m\][$basedir]:\$ \[\e[0m\]" fi else export PS1=$PS1_BAK fi' function roscd { local rosvals if [ -z $1 ]; then cd ${ROS_ROOT} unset ROSCD_MODE return 0 fi _ros_decode_path $1 forceeval if [ $? != 0 ]; then echo "roscd: No such package '$1'" return 1 elif [ -z $rosvals ]; then cd ${ROS_ROOT} return 0 else cd ${rosvals[1]}${rosvals[2]}${rosvals[3]} export ROSCD_MODE=${rosvals[0]} return 0 fi } #################################