Whats different "name.txt" vs "name.txt " in Linux?

If I rename name.bin to name.txt - is normal and file doesn't executable.

If I rename name.bin to file.txt (with space after filename) - file will be executable.

  • 2
    Please prove that assertion, as it is a bit difficult to believe.
    – RudiC
    Oct 20 '18 at 15:41
  • what did you use to "rename" name.bin to file.txt\ ? if you use cp name.bin file.txt\ and file.txt\ already exists and is executable, it will stay that way; cp without the -p flag won't change its permissions.
    – mosvy
    Oct 20 '18 at 15:42
  • Perhaps you're failing to invoke the correct filename? Demonstrate what you're doing so we can follow along.
    – Jeff Schaller
    Oct 20 '18 at 17:33
  • @ctrl-alt-delor attack.mitre.org/wiki/Technique/T1151 Oct 20 '18 at 17:54
  • @interesting, but not a Linux thing, it is a file manager thing. So you are changing weather the file-manager attempts to execute it (not weather it is executable). A simpler solution is to prevent downloaders from setting the execute bit. Oct 20 '18 at 17:59

Whether the file is executable (or not) is a matter of permissions, not of the name.

Use chmod a+x to make it executable and chmod a-x to disallow it. Full details here:


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