How to Rename a file using Mac Terminal


In order to rename a file using Mac Terminal make use of the mv (move) command.

Example:

Suppose I have a file name myfile.txt on the Mac Desktop and I want to rename it to myfile_2020.txt then below are the steps,

  1. Open Mac Terminal,
  2. Move to the Desktop: cd ~/Desktop
  3. Now to rename the file run the mv command,

    Syntax:
    mv current-file-name new-file-name
    % mv myfile.txt myfile_2022.txt
  4. The file will be renamed with myfile_2022.txt
Rename file using Mac Terminal using mv Command
Before renaming the file
Before renaming the file
After renaming the file
After renaming the file
-


Have Questions? Post them here!

Top Hashtags:

Advertisements

Advertisements




Advertisements