I know in Windows, "file extensions", the part of a file name after the final period in the file name, are more than just part of the file name, they also act as metadata to tell Windows what kind of file the document should be treated as, and what apps to open them in (i.e. what apps are associated with those file types).
However, I want to start moving to Linux (Ubuntu) which I installed on my PC a while back, so, I recently tried making a new file ("extensionless"), and I wanted to make it a different type, so I tested to see if that would work by testing by renaming it .go
, so I could try to open it in VSCode like I normally would on WIndows.
Surprise, it doesn't work.
I look up multiple searches, involving how to change the file extension (only getting results using command line), and eventually coming over to a horrifying S.O. answer that horrified me, it gave me the info that "extensions" (file types) are determined by header.
There doesn't seem to be any way in the "Files" file manager for Ubuntu to change the header type.
There seems to be no concept of anything other than a plain "Text" file.
(Well, there is, but you just can't see or change it.)
What I want is a program that can give me a simple GUI to edit the file type of a file so I can easily go between one or the other as needed/wanted.
(Even better, and more appreciated would be some kind of program that works with "Files" to add the option to change the filetype-header in context menu (when a certain file is selected). Though, either will do.)
Info:
OS: Ubuntu 20.04.2 LTS
WindowingSystem: X11
GNOME: 3.36.8
Top comments (2)
You are correct in that the extension doesn't matter and the type of file is determined by the header. But you don't change the header, that can mess up the file. What you instead should change is the default application used to open that file type. You don't say what happens when you try to open the .go file, but when I open both an extensionless or a
.go
file it defaults to Gedit (simple text editor). If I right click that file and selectProperties
and thenOpen With
I can set the default to vscode. Then double clicking the file opens it in vscode.Windows works the same, except that it looks at the file extension instead of the file header to determine which program it should use. If the wrong program is used you can change the default on Windows as well.
Is there any way to set the default program for a group of "extensions" on Ubuntu?
I read what you suggested, but I can't tell if this is file or extension specific.