RobotForge
Published·~16 min

Linux for roboticists

Shell fluency, ssh, tmux, systemd, udev — the half-dozen tools that separate people who kind-of-know-Linux from people who can actually run a robot in the field.

by RobotForge
#foundations#linux#beginner

Robots run Linux. Not macOS, not Windows — Linux, usually Ubuntu. You don't need to memorize 500 commands to be productive. You need working fluency in six things. Here's the list.

The six

  1. Shell basics — files, processes, pipelines
  2. SSH — connecting to the robot
  3. tmux or screen — keeping programs running after you disconnect
  4. systemd — autostarting your code on boot
  5. udev — stable device names when you plug things in
  6. Networking basics — netcat, tcpdump, ip, ping

1. Shell basics

You should be able to do these without looking anything up:

# Where am I, what's here
pwd
ls -la

# Move around
cd ~/ros2_ws/src
cd -   # back to previous directory

# Inspect a file quickly
head -20 README.md
tail -50 /var/log/syslog
less long_file.txt        # q to quit

# Find things
find . -name "*.urdf"
grep -rn "cmd_vel" .

# Pipe outputs
ros2 topic list | grep camera
journalctl -u my-robot.service | tail -100

# Background a running job, bring it back
long_command &
jobs
fg %1

# Kill a process
ps aux | grep turtlesim
kill -9 12345

If any of those are unfamiliar, spend an hour. This is the price of entry.

2. SSH

You will not have the robot on your desk. You will SSH into it from your laptop.

# Connect
ssh ubuntu@robot.local

# Copy a file to the robot
scp config.yaml ubuntu@robot.local:/home/ubuntu/

# Copy a directory from the robot
scp -r ubuntu@robot.local:/var/log/robotforge ./logs/

# Port forward (useful for rviz on laptop, roscore on robot)
ssh -L 8080:localhost:8080 ubuntu@robot.local

# Set up passwordless auth once
ssh-keygen -t ed25519
ssh-copy-id ubuntu@robot.local

After ssh-copy-id, you never type the password again. Do this first on any robot you'll touch more than twice.

3. tmux: the session that survives your disconnect

You SSH in, start ROS 2, close your laptop. Everything you started just died. Enter tmux:

tmux new -s robot          # create a session named "robot"
# ... run your nodes in here ...
# Press Ctrl-b d to detach
# Close your laptop. Fly to Denver.

tmux attach -t robot       # back in, nodes still running

Two tmux keystrokes will save you hours:

  • Ctrl-b c — new window (tab)
  • Ctrl-b % — split current pane vertically
  • Ctrl-b " — split current pane horizontally
  • Ctrl-b d — detach, leave everything running

Screen is the older alternative. Tmux is nicer in 2026.

4. systemd: your code autostarts on boot

Production robots don't rely on you SSH-ing in to run ros2 launch. They have a systemd unit that starts the robot stack when the machine boots.

Create /etc/systemd/system/robotforge.service:

[Unit]
Description=RobotForge stack
After=network.target

[Service]
Type=simple
User=ubuntu
Environment="ROS_DOMAIN_ID=7"
ExecStart=/bin/bash -c 'source /opt/ros/jazzy/setup.bash && \
  source /home/ubuntu/ros2_ws/install/setup.bash && \
  ros2 launch my_robot bringup.launch.py'
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Enable it:

sudo systemctl daemon-reload
sudo systemctl enable robotforge
sudo systemctl start robotforge
sudo systemctl status robotforge   # check it's running
journalctl -u robotforge -f        # tail the logs

Now power-cycle the robot — it comes back up running your code. That's a real robot.

5. udev: stable device names

You plug an Arduino in and it's /dev/ttyACM0. Plug another in and the old one jumps to /dev/ttyACM1. Your code breaks. udev fixes this.

Find the device's USB serial number:

udevadm info -a -n /dev/ttyACM0 | grep serial

Create /etc/udev/rules.d/99-robot.rules:

SUBSYSTEM=="tty", ATTRS{serial}=="85934333038351C0E0D0", SYMLINK+="robot_arm"
SUBSYSTEM=="tty", ATTRS{serial}=="85934333038351C0F123", SYMLINK+="robot_base"

Reload:

sudo udevadm control --reload-rules
sudo udevadm trigger

Now the arm is always /dev/robot_arm regardless of plug order. Your code uses the stable name.

6. Networking basics

ip addr show              # what's my IP
ip route                  # default gateway
ping 8.8.8.8              # can I reach the internet
ping robot.local          # can I reach the robot
netstat -tulpn | grep 8080  # what's listening on port 8080
nc -l 9000                # listen on port 9000
nc robot 9000             # connect to port 9000 on robot
tcpdump -i any port 7400  # watch ROS 2 discovery traffic

When "the robot can't see the sensor" the answer is almost always networking. These commands get you from panic to diagnosis in five minutes.

Bonus: the Linux productivity patterns

  • !! — repeat the last command
  • sudo !! — repeat it with sudo (you forgot, we all forget)
  • Ctrl-r — reverse search through command history
  • cd - — cd to the previous directory
  • >/dev/null 2>&1 — silence a noisy command
  • Aliases in ~/.bashrcalias sros="source /opt/ros/jazzy/setup.bash" saves you a million keystrokes

Where to go deeper

If you only pick one resource, it's The Linux Command Line by William Shotts (free online). For systemd specifically, Lennart Poettering's original blog series is surprisingly readable. For production stuff, Julia Evans's zines (wizard zines) are the warmest introduction to serious Linux tools.

The Linux skill ceiling is high, but the bar for being productive is low. Six tools. One week of practice. Stop being intimidated.

Comments

    Sign in to post a comment.