BASH magic bytes (.bash)
.bash file signature: 23 21 2F | application/x-sh
Category: Source Code
BASH is a Unix shell scripting format associated with the GNU Bash interpreter, created and maintained by the GNU Project. It is used to automate command-line tasks, system administration, software installation, and build or deployment workflows on Unix-like operating systems. Scripts may execute arbitrary commands, so files from untrusted sources should be reviewed before use; the format remains widely supported and is not considered obsolete.
Magic Bytes
Offset 0
23 21 2F
Sources: Apache Tika
All Known Signatures
4 signature variants are documented for .bash files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 23 21 2F | 0 | Apache Tika |
| 23 21 20 2F | 0 | Apache Tika |
| 23 21 09 2F | 0 | Apache Tika |
| 65 76 61 6C 20 22 65 78 65 63 | 0 | Apache Tika |
Validation Code
How to validate .bash files in Python
def is_bash(file_path: str) -> bool:
"""Check if file is a valid BASH by magic bytes."""
signature = bytes([0x23, 0x21, 0x2F])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .bash files in Node.js
function isBASH(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x21, 0x2F]);
return buffer.subarray(0, 3).equals(signature);
}
How to validate .bash files in Go
func IsBASH(data []byte) bool {
signature := []byte{0x23, 0x21, 0x2F}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
/api/v1/bash
curl https://filesignature.org/api/v1/bash
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .bash file?
A .bash file is identified by the magic bytes 23 21 2F at byte offset 0. BASH is a Unix shell scripting format associated with the GNU Bash interpreter, created and maintained by the GNU Project. It is used to automate command-line tasks, system administration, software installation, and build or deployment workflows on Unix-like operating systems. Scripts may execute arbitrary commands, so files from untrusted sources should be reviewed before use; the format remains widely supported and is not considered obsolete.
What are the magic bytes for .bash files?
The magic bytes for BASH (.bash) files are 23 21 2F at byte offset 0. These bytes identify the file format more reliably than the extension alone.
How do I validate a .bash file?
To validate a .bash file, read the first bytes of the file and compare them against the known magic bytes (23 21 2F) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .bash files?
The primary MIME type for .bash files is application/x-sh.
Is it safe to open .bash files?
BASH (.bash) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.