Skip to content

What is mmv Linux command?

The mmv command in Linux allows users to move, copy, append and rename multiple files in bulk with a single command, making file management more efficient.

Terminal window
mmv [option] [parameters]
OptionDescription
-hDisplay help information
-nDo not perform actions, only show what would be done
-vVerbose mode, show detailed information about actions
ParameterDescription
sourceThe file or pattern of files to rename/move.
targetThe target name or pattern to rename/move to.
Terminal window
mmv "*.txt" "prefix_#1"

Adds a prefix “prefix_” to all files with a .txt extension.

Terminal window
mmv "*.jpg" "#1.png"

Changes the file extension of all .jpg files to .png.

Terminal window
mmv "source_dir/*.txt" "destination_dir/#1.txt"

Moves all .txt files from source_dir to destination_dir.

Batch Rename Files with Sequential Numbers

Section titled “Batch Rename Files with Sequential Numbers”
Terminal window
mmv "*" "#1_part_#2"

Renames all files in the directory with a sequential number and a predefined label.

Terminal window
mmv -n "*.jpeg" "#1.jpg"

Performs a dry run without actually renaming any .jpeg files to .jpg.

To use the mmv command in bash, execute the following command:

Terminal window
mmv -r 'file*.txt' 'newfile#1.txt'

What is the purpose of the mmv command in Linux?

Section titled “What is the purpose of the mmv command in Linux?”

The mmv command in Linux is used to move, copy, append, or link multiple files in batch according to pattern matching rules.

How do I move multiple files using mmv in Linux?

Section titled “How do I move multiple files using mmv in Linux?”

To move multiple files with mmv, use the following command:

Terminal window
mmv '*.jpg' 'images/#1.jpg'

Yes, you can copy files using mmv in Linux. To copy files, you can use the following command:

Terminal window
mmv -C '*.pdf' 'backup/#1.pdf'

To rename files using mmv in Linux, you can use the following command:

Terminal window
mmv '*.old' '#1.new'

Can I append a prefix to multiple filenames using mmv in Linux?

Section titled “Can I append a prefix to multiple filenames using mmv in Linux?”

Yes, you can append a prefix to multiple filenames with mmv in Linux. Use the following command:

Terminal window
mmv '*.txt' 'prefix_#1.txt'

How do I use wildcard characters with mmv in Linux?

Section titled “How do I use wildcard characters with mmv in Linux?”

To use wildcard characters with mmv in Linux, you can specify patterns to match multiple files. For example:

Terminal window
mmv 'file_?.txt' 'newfile_#1.txt'
Section titled “Is it possible to link files with mmv in Linux?”

Yes, you can create symbolic links with mmv in Linux. To do this, you can use the following command:

Terminal window
mmv -L '*.log' 'logs/#1.log'
  • Renaming multiple files simultaneously
  • Moving multiple files to a different directory
  • Copying multiple files to another location
  • Mass file renaming based on patterns and rules