Recognize file type by content












1















In Ubuntu 12.10 there was a nice app called Assogiate. It has ability to add new mimetype, add recognition by content of file and new icon, all done by mouse clicking. Now assogiate disappears from repos. Other programs doesn't have that ability. How to do it by hand?



For example:
I have a file test.lzx. This is a packed test file with LZX packer used mostly on Amiga. Gnome doesn't recognize it. If I test file with file command I see:



$ file test.lzx
test.lzx: LZX compressed archive (Amiga)


Recognize that type of file by content is simple. At 0 offset (at the beginning of file) there is a LZX string:



$ hexdump -C test.lzx | head -n 1
00000000 4c 5a 58 00 0c 00 0a 04 00 00 07 00 00 c0 0d 00 |LZX.............|


In Assogiate I was able to add search string and offset where Gnome have to look for this string.



Now question: how to add manually new mime type and make Gnome recognize it by file content?



Answers at




  • How do I change the MIME type for a file?


  • How are file-extensions/mime-types/icons/default applications associated?



are not related to my question.










share|improve this question

























  • Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

    – Panther
    Jul 19 '16 at 17:47











  • I don't want change mime type. I want to add new mime type.

    – QkiZ
    Jul 19 '16 at 21:02











  • If you want to add one, edit away ;) The link I gave you shows you how.

    – Panther
    Jul 19 '16 at 21:11











  • what link? I don't see any link.

    – QkiZ
    Jul 20 '16 at 6:40











  • askubuntu.com/questions/179865/…

    – Panther
    Jul 20 '16 at 14:47
















1















In Ubuntu 12.10 there was a nice app called Assogiate. It has ability to add new mimetype, add recognition by content of file and new icon, all done by mouse clicking. Now assogiate disappears from repos. Other programs doesn't have that ability. How to do it by hand?



For example:
I have a file test.lzx. This is a packed test file with LZX packer used mostly on Amiga. Gnome doesn't recognize it. If I test file with file command I see:



$ file test.lzx
test.lzx: LZX compressed archive (Amiga)


Recognize that type of file by content is simple. At 0 offset (at the beginning of file) there is a LZX string:



$ hexdump -C test.lzx | head -n 1
00000000 4c 5a 58 00 0c 00 0a 04 00 00 07 00 00 c0 0d 00 |LZX.............|


In Assogiate I was able to add search string and offset where Gnome have to look for this string.



Now question: how to add manually new mime type and make Gnome recognize it by file content?



Answers at




  • How do I change the MIME type for a file?


  • How are file-extensions/mime-types/icons/default applications associated?



are not related to my question.










share|improve this question

























  • Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

    – Panther
    Jul 19 '16 at 17:47











  • I don't want change mime type. I want to add new mime type.

    – QkiZ
    Jul 19 '16 at 21:02











  • If you want to add one, edit away ;) The link I gave you shows you how.

    – Panther
    Jul 19 '16 at 21:11











  • what link? I don't see any link.

    – QkiZ
    Jul 20 '16 at 6:40











  • askubuntu.com/questions/179865/…

    – Panther
    Jul 20 '16 at 14:47














1












1








1








In Ubuntu 12.10 there was a nice app called Assogiate. It has ability to add new mimetype, add recognition by content of file and new icon, all done by mouse clicking. Now assogiate disappears from repos. Other programs doesn't have that ability. How to do it by hand?



For example:
I have a file test.lzx. This is a packed test file with LZX packer used mostly on Amiga. Gnome doesn't recognize it. If I test file with file command I see:



$ file test.lzx
test.lzx: LZX compressed archive (Amiga)


Recognize that type of file by content is simple. At 0 offset (at the beginning of file) there is a LZX string:



$ hexdump -C test.lzx | head -n 1
00000000 4c 5a 58 00 0c 00 0a 04 00 00 07 00 00 c0 0d 00 |LZX.............|


In Assogiate I was able to add search string and offset where Gnome have to look for this string.



Now question: how to add manually new mime type and make Gnome recognize it by file content?



Answers at




  • How do I change the MIME type for a file?


  • How are file-extensions/mime-types/icons/default applications associated?



are not related to my question.










share|improve this question
















In Ubuntu 12.10 there was a nice app called Assogiate. It has ability to add new mimetype, add recognition by content of file and new icon, all done by mouse clicking. Now assogiate disappears from repos. Other programs doesn't have that ability. How to do it by hand?



For example:
I have a file test.lzx. This is a packed test file with LZX packer used mostly on Amiga. Gnome doesn't recognize it. If I test file with file command I see:



$ file test.lzx
test.lzx: LZX compressed archive (Amiga)


Recognize that type of file by content is simple. At 0 offset (at the beginning of file) there is a LZX string:



$ hexdump -C test.lzx | head -n 1
00000000 4c 5a 58 00 0c 00 0a 04 00 00 07 00 00 c0 0d 00 |LZX.............|


In Assogiate I was able to add search string and offset where Gnome have to look for this string.



Now question: how to add manually new mime type and make Gnome recognize it by file content?



Answers at




  • How do I change the MIME type for a file?


  • How are file-extensions/mime-types/icons/default applications associated?



are not related to my question.







mime-type






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 9 at 4:55









Pablo Bianchi

2,4451530




2,4451530










asked Jul 19 '16 at 17:41









QkiZQkiZ

6871526




6871526













  • Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

    – Panther
    Jul 19 '16 at 17:47











  • I don't want change mime type. I want to add new mime type.

    – QkiZ
    Jul 19 '16 at 21:02











  • If you want to add one, edit away ;) The link I gave you shows you how.

    – Panther
    Jul 19 '16 at 21:11











  • what link? I don't see any link.

    – QkiZ
    Jul 20 '16 at 6:40











  • askubuntu.com/questions/179865/…

    – Panther
    Jul 20 '16 at 14:47



















  • Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

    – Panther
    Jul 19 '16 at 17:47











  • I don't want change mime type. I want to add new mime type.

    – QkiZ
    Jul 19 '16 at 21:02











  • If you want to add one, edit away ;) The link I gave you shows you how.

    – Panther
    Jul 19 '16 at 21:11











  • what link? I don't see any link.

    – QkiZ
    Jul 20 '16 at 6:40











  • askubuntu.com/questions/179865/…

    – Panther
    Jul 20 '16 at 14:47

















Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

– Panther
Jul 19 '16 at 17:47





Other than that you have to edit user files or if needed system files manually but there should be little to no need for doing so (manual edits).

– Panther
Jul 19 '16 at 17:47













I don't want change mime type. I want to add new mime type.

– QkiZ
Jul 19 '16 at 21:02





I don't want change mime type. I want to add new mime type.

– QkiZ
Jul 19 '16 at 21:02













If you want to add one, edit away ;) The link I gave you shows you how.

– Panther
Jul 19 '16 at 21:11





If you want to add one, edit away ;) The link I gave you shows you how.

– Panther
Jul 19 '16 at 21:11













what link? I don't see any link.

– QkiZ
Jul 20 '16 at 6:40





what link? I don't see any link.

– QkiZ
Jul 20 '16 at 6:40













askubuntu.com/questions/179865/…

– Panther
Jul 20 '16 at 14:47





askubuntu.com/questions/179865/…

– Panther
Jul 20 '16 at 14:47










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f800574%2frecognize-file-type-by-content%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f800574%2frecognize-file-type-by-content%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?