I have a file that is formatted as a .doc, but Nautilus and LibreOffice insists that it is a .txt. Both precise and Ubuntu 12.10 are that way, but Google Docs can convert it (after playing with it).
3 Answers
To check if 'extension' mime type exist:
grep 'extension' /etc/mime.typesTo create new mime type:
Open /etc/mime.types with text-editor(with root privileges)
gksudo gedit /etc/mime.typesAdd extension to /etc/mime.types in following format:
text/extension extension
Could be something as simple as a mangled/intentionally changed header. Here's what the MS Word first 2 chunks looks like in a couple of documents I just checked:
D0 CF 11 E0 A1 B1 1A E1
You could MAKE A BACKUP and try changing the first several bytes to that signature and see if it doesn't at least TRY to open as the right thing.
Generally, file can look at this area:
And tell the file-type. If it's detecting it wrong, either it actually is a text file renamed to doc or the header got borked.
- In Nautilus, right-click on any file with the desired filetype or extension, choose
Propertiesfrom the context menu. - In
Propertiesclick on theOpen With. - Select an application for the given filetype (
writerI asssume). All files with the same extension will now be opened with this program by default.
You can do this manually too
/usr/share/applications/defaults.listholds the defaults (ie. system wide associations).~/.local/share/applications/mimeapps.listholds user specifics.
By the way: I assume you have software installed (ie. LibreOffice) that can open doc files?
From the comments and images added:
- it could be that the file is corrupt. What a file is is based on the 1st byte of a file (and not the extension as Windows does). What you could do is set
.txtfiles to open with Writer (just temporary) and see if it then does open and then save it under another name. Then reset openingtxtto Gedit or what it was before.