How to Change a File Extension in Linux

How to Change a File Extension in Linux thumbnail
Changing a file extension in Linux involves the 'mv' command.

Changing the extension of a file from the Linux command line involves the same command as changing the filename itself: the "mv" (move) command. Essentially, you are "moving" the original file into a new file with a different extension. If you make a mistake when re-assigning a file extension, you can use the "mv" command to change it back.

Instructions

    • 1

      Open your preferred command line utility, like Terminal (Mac OS X) or the command line prompt (Windows).

    • 2

      Connect to your server:

      ssh yourdomain.com

      Replace yourdomain.com with your specific domain name or IP address.

    • 3

      Change to the directory where the file you want to modify is located:

      cd /path/to/folder

      Replace /path/to/folder with the specific path to your folder, i.e. /var/public_html/yourdomain.com/public

    • 4

      Type the following command:

      mv filename.oldextension filename.newextension

      For example, if you want to change "index.html" to "index.php" you would type the following command:

      mv index.html index.php

Related Searches:

References

  • Photo Credit computer image by blaine stiger from Fotolia.com

Comments

You May Also Like

Related Ads

Featured