DEV Community

Discussion on: Is there any way I can change a file header in Linux like how I'd change a file extension in Windows (10).

Collapse
 
cappe987 profile image
Casper

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 select Properties and then Open 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.

Collapse
 
baenencalin profile image
Calin Baenen • Edited

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.