File types / Programs & scripts
.sh file
Shell script
- Extensions
- .sh
- MIME type
application/x-sh- Signature
23 21(#!)at byte offset 0- Safety
- Can run code
What is a .sh file?
A shell script is a text file of commands. If it starts with #! (called a shebang) followed by an interpreter path such as /bin/sh, the system will run it with that program.
Anyone can read a script, which makes it easy to check what it does before running it.
Used for: Automation and installers on Linux and macOS.
How can I tell if a file is really a SH?
Read its first bytes rather than trusting the name. A genuine SH file has the signature 23 21 (#!) at byte offset 0. Text file; #! at the start marks an executable script. The File Identity tool reads these bytes in your browser, so the file is never uploaded.
To compare the name against the content, use Validate Extension. To see the raw bytes, use Safe File Preview.
Is a .sh file safe to open?
Scripts run with your permissions. Never pipe a script from the internet into a shell without reading it first.
Easy to confuse
A file with no extension that starts with #! is a script.