Change file kind / kMDItemContentType I have two text files with no extension and made them executable. Both are set to open with Terminal app. However one file is shown as kind "Text" and the other one as "executeable unix file".

if I display the metadata attributes with 


  mdls &lt; filename >


I can see the the Content Type is different:

file 1 shows:

...
kMDItemContentType                  = "public.unix-executable"
...


file 2 shows:

...
kMDItemContentType                  = "com.apple.traditional-mac-plain-text" 
...


How can I set the kMDItemContentType of file 2 also to "public.unix-executable"? Is there a command line to to change it?
Explicitly set it within the file itself. 

Right click (or option + click) the file > Open With > Other... > TextEdit. 

Alternatively, you can use a text editor such as nano or vi within Terminal. 

Set the attribute below the shebang line

#! /bin/bash

kMDItemContentType = "public.unix-executable" 

#Rest of your shell script


I just tested this on a script in my bin:

njboot$ mdls /Users/njboot/bin/jpgrm 
kMDItemContentCreationDate     = 2014-06-10 06:06:53 +0000
kMDItemContentModificationDate = 2014-06-11 19:58:23 +0000
kMDItemContentType             = "public.unix-executable"
kMDItemContentTypeTree         = (
    "public.unix-executable",
    "public.data",
    "public.item",
    "public.executable"
)