zGiven that most of you will access ROS through the terminal (the -X next to ssh indicates that you can try to run GUI tools, but the speed is excessively slow), here are some terminal commands and tools that will make working in the terminal a lot easier.
Tmux is a terminal multiplexer, which means that you can run multiple terminal shells in one window. Type
tmux into the terminal, and it should take you a nearly identical terminal window.
Ctrl-b + %– Split the terminal vertically into two panes
Ctrl-b + "– Split the terminal horizontally into two panes
Ctrl-b (with continued press) + arrow_key– Resize the pane
Ctrl-b + arrow_key– Change pane selection
Ctrl-b + x– terminal the current selected pane
Ctrl-b + [– Read mode (ESC and move cursor to escape)
vim (or nano)
vimtutorfor practice (which will take about 10 minutes), or google for basic vim commands. You only really use ~10 commands, so I think it’s worth learning vim.
Ctrl-W + Arrow_keysand terminate each pane using
Esc and typing :wq (for editor) and :q (file explorer).
To redirect the terminal output to a file (so you can read the error output)
some_command >file.log 2>&1
Run a command in the background:
Move out of current folder
How to run a command every terminal launch
~/.bashrc (e.g. vim ~/.bashrc) and put commands at the bottom.
~/.bashrc is essentially a shell (bash) command that runs when you first open the terminal, which means that you can put setup commands in
~/.bashrc so that you would not have to type them over and over again.
~/.bashrc, you can put
~/catkin_ws/devel/setup.bash (which is within ROS workspace) as one of the setup files to execute at launch. What
setup.bash does is that it sets up the path variables for ROS, allowing commands like
roscd to find where the directory with packages is.
For those who are not so familiar with the terminal language, a “shell” is the terminal – a way for the user to interact with the operating system (Linux, in this case).
roscd <package_name> <folder_name>
rosed <pacakge_name> <file_name> – Opens file for editing
roscd (ros + cd) and
rosed (ros + ed), they are essentially shortcuts for cd and ed to edit ROS package files quickly.