Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - man page - RENAME

    RENAME

    WillieBy WillieMarch 24, 2026Updated:March 24, 2026No Comments2 Mins Read
     

    NAME

    rename – renames multiple files  

    SYNOPSIS

    rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr [ files ]  

    DESCRIPTION

    "rename" renames the filenames supplied according to the rule specified as the first argument. The perlexpr argument is a Perl expression which is expected to modify the $_ string in Perl for at least some of the filenames specified. If a given filename is not modified by the expression, it will not be renamed. If no filenames are given on the command line, filenames will be read via standard input.

    For example, to rename all files matching "*.bak" to strip the extension, you might say

            rename ‘s/\e.bak$//’ *.bak
    
    

    To translate uppercase names to lower, you’d use

            rename ‘y/A-Z/a-z/’ *
    
    
     

    OPTIONS

    -v, -verbose
    Verbose: print names of files successfully renamed.
    -n, -nono
    No action: print names of files to be renamed, but don’t rename.
    -f, -force
    Over write: allow existing files to be over-written.
    -h, -help
    Help: print SYNOPSIS and OPTIONS.
    -m, -man
    Manual: print manual page.
    -V, -version
    Version: show version number.
    -e
    Expression: code to act on files name.

    May be repeated to build up code (like "perl -e"). If no -e, the first argument is used as code.

    -E
    Statement: code to act on files name, as -e but terminated by ‘;’.
     

    ENVIRONMENT

    No environment variables are used.  

    AUTHOR

    Larry Wall  

    DIAGNOSTICS

    If you give an invalid Perl expression you’ll get a syntax error.  

    BUGS

    The original "rename" did not check for the existence of target filenames, so had to be used with care. I hope I’ve fixed that (Robin Barker).

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    OPENDIR

    April 21, 2026

    TAIL

    April 21, 2026

    OPERATOR

    April 21, 2026

    NANO

    April 21, 2026
    Top Posts

    How To Fix VCRuntime DLL Error on Windows

    February 27, 2026

    What Is GRUB In Linux

    February 18, 2026

    Linux Backup Solution Adoption Rates 2026

    February 4, 2026

    LP

    April 13, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.