Ubuntu – How to change a document’s extension / file extension / file format

extensionfile formatfilesrename

In Windows there's an option to view extensions for known file types. When I enable that option I see all the files with their respective extension; for example an mp3 music file is: name.mp3

If I rename it to name.txt, then the default program to view the file would be text editor.

How do I rename a file's extension in Ubuntu?

I want to create the file: autorun.inf

In Windows I just create a new text document .txt (enable the view of extensions) and rename it to .inf, but in Ubuntu that doesn't work.

So how can I do that in Ubuntu?

Best Answer

Forget about the concept of "file extensions" that thing is completely made up and useless. For example somebody could rename a music file on your system to garbage.gbr and since windows interprets extensions literally as file types it wouldn't even know that the file was a music file.

In Ubuntu on the other hand, you can name a file whatever you wish. You don't even have to choose an extension if you don't feel like it. Ubuntu will read the MIME type of the file and understand what type it is. Based on the file type it will associate it to the appropriate program to open it. You still have all the control you need. You can change the default program associated with a MIME type in several ways.

enter image description here

To change default program association of a file type, just right click on a file with that type and choose Properties and go to Open With tab.

Now that being said, I should mention that extensions are not completely useless in Ubuntu. They still provide a standard way to tag a file for easy identification of its type -- but they don't set the file type. The only exception to this is when saving a file in some applications that support saving in several different formats. When you provide a file name in those application it can read the extension you provided and based on that decides how to create and save your new file with the correct mime type. For example if you open a JPEG file in GIMP and then choose save as ... and enter image.png, GIMP opens the PNG file dialogue and lets you save the file with PNG MIME Type.