# FreeBSD version from filesystem



## balanga (May 1, 2019)

Is there a specific file in the filesystem which will identify which version of FreeBSD is installed?


----------



## hukadan (May 1, 2019)

One way to do it is using file(1) :

```
% file /bin/sh
/bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0 (1200506), FreeBSD-style, stripped

% file /usr/local/poudriere/jails/110arm/bin/sh
/usr/local/poudriere/jails/110arm/bin/sh: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100122), FreeBSD-style, stripped
```


----------



## malavon (May 1, 2019)

The file you're actually looking for is the kernel and it's the authority of installed version.
You can get the information out of it using `freebsd-version`, which exists as `/bin/freebsd-version`
It's a shell script, rather difficult to read in case you want to write your own.


----------



## acheron (May 1, 2019)

You also have __FreeBSD_version in /usr/include/sys/param.h


----------

