urxvt: Quick Guide to Rxvt-unicode Terminal


Quick start

urxvt is a lightweight, highly customizable terminal emulator (Rxvt-unicode). This guide focuses on practical, real-world uses and common gotchas.

# Open a new urxvt window
urxvt

Open in a specific directory

If you want the new terminal to start in a particular directory, use -cd.

urxvt -cd /path/to/directory

Run a command in a new urxvt window

To run a command immediately in a separate window, pass it with -e.

urxvt -e top

Notes:

  • Some shells require you to pass the command as a single string depending on your shell configuration.
  • If your command contains spaces or special characters, quote them appropriately.

Run a command and keep the window open

By default, urxvt may close after the command finishes. Use —hold to keep the window open.

urxvt --hold -e ls -la /var/log

Common pitfall: forgetting the —hold flag means the terminal closes as soon as the command completes.

Run a command within a shell

If you want to run a command via a shell (e.g., to take advantage of shell features), you can start the shell with -e and then use -c to run your command.

urxvt -e sh -c "echo Hello && pwd && ls -l"

Alternative forms:

  • Some environments require the command to be the first argument to -e, others to be passed as a shell command via -c. Test what works in your setup.

Shortcuts and customization

urxvt can be heavily customized via X resources or command-line arguments. Common tweaks include font, background color, and transparency. Example Xresources:

URxvt.font: xft:DejaVu Sans Mono:size=10
URxvt.background: rgba:0000/0000/0000/dfdf

Or pass options directly:

urxvt -/f 'DejaVu Sans Mono-12' -pe 80

Common pitfalls

  • Not escaping arguments: Commands with spaces or special characters may fail if not quoted.
  • Different shells behave differently with -e and -c. If your command doesn’t run, try wrapping it in a shell invocation (e.g., sh -c ”…” ).
  • Terminal closing unexpectedly: Remember the —hold flag if you want to inspect output after completion.
  • Missing urxvt: Some distributions don’t install it by default. Look for package name urxvt or rxvt-unicode.

When to use urxvt vs alternatives

  • Use urxvt for lightweight, highly customizable setups. If you need built-in tabs or more advanced features, consider alternatives like kitty, alacritty, or gnome-terminal.
  • For quick one-off commands in a new window, urxvt -e is handy.

TL;DR safety check

  • Always test your command in a regular shell first before using -e in a new window.
  • Verify paths and permissions when starting in a specific directory.

Summary

urxvt provides a minimal, fast terminal with flexible invocation options. Start a new window, run commands directly, or keep the window open for inspection. With a few flags, you can tailor its behavior to fit your workflow.

See Also