Что такое формат файла EXEC?
Executable files for Unix and Unix-like systems can be saved with the .exec extension. A .exec file can hold virtually any program executable on a given operating system - either a compiled binary (such as an ELF binary on Linux/Unix) or a plain-text interpreter script. .exec has its counterpart in the form of .exe files on Windows systems.
As a rule on Unix systems, executable files are saved without any extension - the .exec suffix is used to mark executable files in file managers and IDEs on macOS, Linux, or FreeBSD, distinguishing the runnable output from source files.
The ability to execute a .exec file is determined by the file's permission bits and its internal header, not the extension. The kernel checks magic bytes at offset 0: ELF binaries begin with \x7FELF, macOS Mach-O binaries with FEEDFACE, and scripts with #! followed by an interpreter path (e.g., #!/bin/bash for a .sh script).
.exec files can be run from the command line (shell). On macOS, the executable bit (the x permission attribute) is what matters - a file runs correctly with or without the .exec extension. Before running an unfamiliar .exec file, use the file command to confirm its actual type.
Безопасность и защита
РИСК: HIGHAn executable is the highest-risk file type to run from an untrusted source: a .exec runs with your user privileges and can read, modify, encrypt or delete your files and download more code. Before running one you didn't build: run 'file file.exec' to see what it is, and if it's a text script, read it first. On macOS, Gatekeeper will block unsigned/unnotarized binaries by default - that warning is there for your protection. Never blindly 'chmod +x' and run a file from a forum, email or random download. The extension '.exec' confers no safety; trust the source, not the suffix.
Детали формата
в двух словах- Application/IDE export marker - Some build tools and apps name their produced runnable artifact *.exec purely as a label; the real type underneath is still ELF/Mach-O/script.
Программы, открывающие файлы EXEC
Технические подробности
глубокая спецификация| Encoding | Binary (ELF or Mach-O compiled code) or plain text (interpreter script with shebang) |
| Binary format on Linux/Unix | ELF (Executable and Linkable Format) - magic bytes 7F 45 4C 46 ("\x7FELF") at offset 0 |
| Binary format on macOS | Mach-O - magic FE ED FA CE (32-bit) or FE ED FA CF (64-bit); fat/universal binaries use CA FE BA BE |
| Script marker | Shebang (#!) at byte offset 0 followed by interpreter path, e.g. #!/usr/bin/env python3 - parsed by the kernel before execution |
| MIME type | application/x-executable (Linux binary); application/x-mach-binary (macOS); application/x-shellscript (text script) |
| Execution control | Unix permission bits - the executable (x) bit must be set; the .exec extension itself is ignored by the kernel |
| Target platform | Linux, macOS, BSD variants (FreeBSD, OpenBSD, NetBSD), Solaris, and other Unix-like systems |
| Byte order | Little-endian for x86-64 and ARM (most modern hardware); big-endian on legacy RISC Unix platforms such as SPARC and MIPS |
| Typical file size | 1 KB (minimal shell script) to tens of MB (statically linked compiled binary) |
| Architecture encoding | Embedded in ELF e_machine field (x86-64 = 0x3E, ARM64 = 0xB7, RISC-V = 0xF3) or Mach-O cputype/cpusubtype fields |
| Code integrity | No inherent checksum in the format; macOS supports code signing via the codesign tool; Linux relies on external GPG or package-manager signatures |
| Compression | Not built-in to the format; binaries may be UPX-packed or wrapped in a self-extracting shell script |
| Extension convention | The .exec suffix is informal - most native Unix executables carry no extension; the OS uses magic bytes, not the filename, to determine how to run the file |
| Windows counterpart | .exe (PE/COFF format) - the extension is mandatory on Windows, unlike .exec which is optional on Unix |
| Inspection command | The file command identifies the actual binary type (ELF, Mach-O, or script interpreter) regardless of the .exec extension |
| Выпущен | N/A (extension-less executables predate the .exec label; concept from early Unix) |
| Последняя версия | N/A - .exec is a convention, not a versioned format |
| Спецификация | refspecs.linuxfoundation.org |
Конвертации EXEC
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах EXEC.