# .sh MIME Type: application/x-sh

> Shell scripts. There's no registered type; application/x-sh is the usual server mapping.

- MIME type: `application/x-sh`
- Extensions: .sh
- Also seen as: `text/x-shellscript`, `text/x-sh`
- Content-Type header: `application/x-sh; charset=utf-8`
- Compress in transit: yes

## Good to know

- `file --mime-type` reports shell scripts as `text/x-shellscript`. Either works for downloads.
- Serve install scripts as `text/plain` if you want people to read them in the browser before running them — `curl … | sh` ignores the Content-Type either way.
- A script needs the execute bit to run directly: [chmod +x](https://www.devkult.com/chmod/plus-x.md) script.sh.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/x-sh sh;
```

### Apache (.htaccess or server config)

```
AddType application/x-sh .sh
```

### Express

```
res.set("Content-Type", "application/x-sh; charset=utf-8");
```

### Python

```
import mimetypes

mimetypes.add_type("application/x-sh", ".sh")
```

### HTML file input

```
<input type="file" accept=".sh,application/x-sh">
```

## FAQ

### What is the MIME type for .sh files?

`application/x-sh`. You may also see `text/x-shellscript`, `text/x-sh`, but `application/x-sh` is the one to send.

### What Content-Type header should a .sh file be served with?

`Content-Type: application/x-sh; charset=utf-8`. As a text format, include the charset so browsers don't guess the encoding. It compresses well, so let the server apply gzip or Brotli.

## Related types

- [.py — text/x-python](https://www.devkult.com/mime/py.md)
- [.txt — text/plain](https://www.devkult.com/mime/txt.md)

Open the interactive page: https://www.devkult.com/mime/sh