How to Install and Use pipe-rename in Linux to Batch Rename Files in Your Text Editor

Batch renaming dozens or hundreds of files on the Linux command line is traditionally handled with shell parameter expansion loops, find -exec routines, or tools such as rename and mmv. While effective for simple pattern substitutions, constructing complex regular expressions on the fly can feel nerve-wracking when dealing with precious project assets or photo libraries. pipe-rename (also known as renamer) offers a refreshing, human-centric alternative: it opens your entire list of filenames directly inside your favourite terminal text editor (such as Vim, Neovim, Nano, Micro, or Kakoune), allowing you to rename files using native editor search-and-replace, visual block selections, and multi-cursors.

Why Use pipe-rename for Batch File Renaming?

Instead of memorising obscure command-line formatting flags, pipe-rename leverages the editing power you already master daily:

  • Full Text Editor Freedom: Use familiar text-editing operations—such as visual block selections (Ctrl + V in Vim), incremental search and replace (:%s/old/new/g), or multi-cursors—to rename filenames simultaneously.
  • Interactive Diff Preview: Before executing any filesystem changes, pipe-rename displays a colourised diff showing old filenames versus proposed new filenames and prompts for confirmation.
  • Collision and Error Detection: Automatically flags filename collisions, invalid filesystem characters, and missing target paths before touching your disk.
  • Undo Support: Generates an automated transaction log, allowing you to reverse complex renaming operations with a single undo command if you make an unintended mistake.

How to Install pipe-rename in Linux

Pipe-rename is distributed as a lightweight static binary and via the Cargo Rust ecosystem.

Method 1: Install via Cargo (Recommended)

If you maintain a local Rust environment, install pipe-rename directly from crates.io:

cargo install pipe-rename

This installs the binary as renamer inside your ~/.cargo/bin directory.

Method 2: Install Pre-Compiled Binary via GitHub

Download the latest release binary directly from GitHub releases:

wget https://github.com/marcusbuffett/pipe-rename/releases/latest/download/pipe-rename-x86_64-unknown-linux-musl.tar.gz
tar -xzf pipe-rename-x86_64-unknown-linux-musl.tar.gz
sudo mv renamer /usr/local/bin/
renamer --version

Method 3: Install on Arch Linux

Arch Linux and Manjaro users can install pipe-rename directly via the AUR using an AUR helper such as Paru or Yay:

yay -S pipe-rename

How to Use pipe-rename to Batch Rename Files

Pipe-rename determines your preferred text editor by checking the standard $EDITOR or $VISUAL environment variables (falling back to Nano or Vi if unset).

Step 1: Launch renamer in the Target Directory

To rename specific files or an entire folder of files, run renamer followed by a path glob or file list:

# Rename all JPEG files in the current folder
renamer *.jpg

# Rename all files matching a pattern
renamer episode_*.mp4

Step 2: Edit Filenames in Your Editor

Your configured text editor opens immediately with a temporary file containing one original filename per line:

IMG_20261012_001.jpg
IMG_20261012_002.jpg
IMG_20261012_003.jpg

Simply edit the text as you would any normal document. For example, replace IMG_20261012_ with holiday_photo_:

holiday_photo_001.jpg
holiday_photo_002.jpg
holiday_photo_003.jpg

Save and close the file (:wq in Vim or Ctrl + O, Ctrl + X in Nano).

Step 3: Review the Diff and Confirm

Upon exiting the editor, pipe-rename evaluates your edits and prints a formatted preview:

Defaulting to rename
IMG_20261012_001.jpg -> holiday_photo_001.jpg
IMG_20261012_002.jpg -> holiday_photo_002.jpg
IMG_20261012_003.jpg -> holiday_photo_003.jpg
Continue? [y/N]:

Type y and press Enter to apply the rename atomically. If you notice an error in the preview, press n to cancel the operation without modifying your filesystem.

How to Undo an Accidental Batch Rename

If you realise after committing a rename that you truncated essential extensions or introduced an unwanted typo, reverse the entire transaction effortlessly:

renamer --undo

Pipe-rename inspects its internal history log and restores every file back to its exact previous name.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.