mmv - Linux


mmv is a command-line utility for Unix-like operating systems designed for efficiently renaming, moving, or linking multiple files using wildcard patterns. It is particularly useful in situations where batch operations on filenames need to be performed following a pattern that specifies both the source and destination of the files.


The basic syntax of the mmv command is:

mmv [options] source_pattern destination_pattern
  • source_pattern: Specifies the pattern that matches the files you want to manipulate.
  • destination_pattern: Defines how the matched files should be renamed or moved.


mmv includes several options that alter its behavior:

  • -m or --move: Move files (default operation).
  • -c or --copy: Copy files instead of moving.
  • -l or --link: Make links instead of moving.
  • -s or --symlink: Make symbolic links instead of hard links.
  • -a or --append: Append to the destination file if it already exists.
  • -d or --delete: Delete source files after copying/linking.
  • -r or --rename: Just rename the files within their current directories.
  • -v or --verbose: Output verbose information, showing files as they are processed.
  • -n or --noexec: Show what would be done without actually doing it.


Here are some practical examples of how to use mmv:

  1. Rename multiple files:

    mmv "*.txt" "#1.bak"

    This command renames all .txt files in the current directory by changing their extension to .bak.

  2. Move and rename files:

    mmv "data/*.csv" "backup/#1.csv.bak"

    Move all .csv files from the data directory to the backup directory, adding .bak to their names.

  3. Use wildcards to change case:

    mmv "???" "tmp/#l1l2l3"

    Any three-character filename gets moved to the tmp directory with all letters changed to lowercase.

Common Issues

  • Pattern matching issues: Ensure your wildcard patterns correctly match your intended files. Misaligned patterns can lead to no files being processed.
  • Permission errors: mmv operations can fail if the executing user lacks sufficient permissions on the source or destination files/directories.


mmv can be combined with shell scripts or other command-line tools to automate file processing tasks. For example:

find . -type f -name "*.log" -exec mmv "{}" "archive/#1-$(date +%Y%m%d).log" \;

This command finds all .log files and moves them into an archive directory with a date stamp added to their names.

  • mv: Standard command for moving or renaming files.
  • cp: Copy files and directories.
  • ln: Create hard and soft links.

Further reading and official documentation can be found typically in the Unix and Linux man pages or online resources specific to your distribution or Unix variant.