Octet Stream Viewer

Octet Stream Viewer 6,8/10 5409 votes

A Multipurpose Internet Mail Extension, or MIME type, is an internet standard that describes the contents of a variety of files. MIME types identify internet files based on their nature and format. This cataloging helps the browser open the file with the appropriate extension or plugin.

I have downloaded some log files from my server which I want to search for a specific string for debugging purposes. All of them have the .log extension.

The problem is that one file has the plain text document (text/plain) mime type while the other has the Binary (application/octet-stream) mime type.

I can open the plain text document (text/plain) mime type log file in a text editor as plain text but the other I can't since it's in binary.

How can I view the binary .log files with application/octet-stream mime type?

Parto
PartoParto

2 Answers

From this answer in What makes grep consider a file to be binary?

If there is a NUL character anywhere in the file, grep will consider it as a binary file.

There might a workaround like this cat file tr -d '000' yourgrep to eliminate all null first, and then to search through file.

Kp astrology tutorial in telugu. I first tried it with one file in a test directory:

And the result, a plain text document (text/plain) text mime file.

Then since I am working with multiple files, I tried running the same command for multiple files in a directory:

And awesome, all my log files are now in a readable format!! :)

Community
PartoParto

Based on your own answer, you seem to be referring specifically to searching files using grep, rather than to changing a file's mime-type - see What is the XY problem?.

If grep is simply misidentifying the files based on null bytes, then you can use the -a or --binary-files=text options to tell grep to treat them as text regardless, as described in the manual pages:

Community
Octet Stream Viewer
steeldriversteeldriver

Not the answer you're looking for? Browse other questions tagged mime-typefile-type or ask your own question.

How does Ubuntu or any other Linux systems store file associations?

Is there some /etc/asscociations file or something?

I know that I can right click on file and change it via 'open with', but I'm just curious to know how it's stored internally.

StannStann

9 Answers

The file manager (Nautilus, by default) uses the MIME type of a file to determine which program to open it with. When an application is installed, it can specify what MIME types it can open and the command to use to open the files in the .desktop file which is placed in /usr/share/applications. This is the file used for menus, desktop shortcuts, etc.

For example, GIMP has the following .desktop file:

See the MimeType field - this lists the supported MIME types.The Exec field tells the system to use the command gimp-2.7 %U, replacing '%U' with the files to open. (Note GIMP 2.7 is a version I have installed from a PPA, so is higher than the current version in the Ubuntu repositories).

When the application package is installed, the system extracts this MIME type data into a more easily accessible database because looking in each .desktop file would take too long if it was done every time a file was opened.

This tells the system what applications can be used for that MIME type and provides the applications in the 'Open With' list. The default is defined elsewhere. The file /usr/share/applications/defaults.list provides the information for the system defaults. Unless you choose otherwise, these are the applications used when you 'Open' a file.

Community
dv3500eadv3500ea

To supplement dv3500ea's excellent answer, I would like to add some information about what happens when you change your associations.

While the defaults.list (which you can find by typing 'locate defaults.list') provides the list of applications that are associated with each MIME type, any customizations that you make are stored in your home directory, in ~/.local/share/applications/mimeapps.list. So if you add or remove associations, or change the default association, this file is updated.

The GNOME Desktop System Administration Guide at http://library.gnome.org/admin/system-admin-guide/stable/ does not appear to discuss mimeapps.list, but I found the following description on http://live.gnome.org/SysAdminGuideUpdate:

mimeapps.list is located in $XDG_DATA_DIRS/applications. Its purpose is to add or remove mime associations from applications. nautilus writes ~/.local/share/applications/mimeapps.list when the user makes changes in the 'Open With' dialog.

user8979

I found that on my system (Debian Jessie) there's also a ~/.config/mimeapps.list that had an association I accidentally created to open a specific file type with gedit. None of the standard ways of correcting this (default application settings, Thunar's open with property) reflected this, but gedit was the default application.

I was able to remove the line from ~/.config/mimeapps.list and now the correct application opens the file. 2018 dj song download.

Bryan LeamanBryan Leaman

Create a file truecrypt.desktop in ~/.local/share/applications with the following lines:

then edit the file ~/.local/share/applications/mimeapps.list and add the following line:

I found out the mime type of Truecrypt by following running this command:

BlindfreddyBlindfreddy

I found this link concerning default association, it might be helpful.https://wiki.archlinux.org/index.php/Default_Applications
for global association:

per user association:

syntax is as follow:

[Added Associations] section is used to specify preferred (default) applications in decreasing preference. which means desktopfile1 is the most preferred and desktopfileN is least preferred.
[Removed Associations] section is used to explicitly remove any previously inherited associations.

MusuNajiMusuNaji

I was able to set an association like this:

You can also remove associations and do other things: man xdg-mime

I did not need to run sudo update-desktop-database.

warvariucwarvariuc

mimeapps.list search path

Others have mentioned this file, but none have explained it's location precisely.

The freedesktop.org standard says at https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.html :

The lookup order for this file is as follows:

and then the default values for those environment variables is given at https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html :

  • $XDG_DATA_HOME: $HOME/.local/share
  • $XDG_CONFIG_HOME: $HOME/.config
  • $XDG_DATA_DIRS: none, appended to XDG_DATA_HOME
  • $XDG_CONFIG_DIRS: none, appended to XDG_CONFIG_HOME

Older versions of Ubuntu may not check ~/.config, so make sure you try ~/.local/share as well.

Commands like:

will automatically edit those files.

Ciro Santilli 新疆改造中心996ICU六四事件Ciro Santilli 新疆改造中心996ICU六四事件

For all users:

Mime Application Octet Stream

/usr/share/applications/defaults.list

Each user has a config file for overriding these defaults:

~/.config/mimeapps.list

Octet

see also https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html for places that might be used for overriding defauts.

Octet Stream Viewer Download

You must know the mime-type of the file you want to change it's association.

Also all associations can be handled-changed in command line using:

xdg-mime

XoristzatzikiXoristzatziki

Freedesktop.org (previously called the X Desktop Group, thus the 'XDG' abbreviation) is the group currently driving X standards like this (learn more at Wikipedia).

warvariuc's answer already mentions xdg-mime usage like:

After lots of playing with image editors and viewers, I ended up with different viewers for different image types with almost no consistency, especially among the rarer image types.

I took the above command and assigned it to each of the MIME types controlled by the image viewers and then created a new image-viewer.desktop by cloning one of them (this is optional, you can merely reuse your favorite). Next, I manually verified that none of the MIME types would be incompatible with my new preferred application. Finally, I set that application to be the default for all of the other applications' MIME types:

This examines the .desktop files for each of the viewers (Ristretto, Geeqie, and GThumb in my case), extracts the MIME definition (which is prefaced by MimeType= and then contains a semicolon-delimited list), removes the (previously matched) preface label, and splits the list into one entry per line. sort -u then removes the redundant lines, then they're handed to xdg-mime to set the new defaults.

(If you want to test this before running it live, change xargs to xargs echo and it will print the resulting command instead of running it.)

This technique should work for anything you want to reclaim for a target app. You don't even need to create a new .desktop file (you can use an existing one). I did that extra step so that when I inevitably change my allegiance between image previewers, I merely need to change that one file.

Octet Stream Viewer

Adam KatzAdam Katz

Not the answer you're looking for? Browse other questions tagged filesmime-typefile-association or ask your own question.

Posted on