# Which files uname utility uses to get information?



## m4rtin (Oct 3, 2010)

Which files *uname -a* reads in order to gather information?


----------



## fronclynne (Oct 3, 2010)

Looks to me like it grabs it using sysctl(3).

See also /usr/src/usr.bin/uname/uname.c or your friendly, local snv server.

Additionally, look perhaps at the kern.version, kern.ostype, kern.osrelease, kern.osrevision sysctls, too.


Edit:  So, I guess the answer is that uname(1) reads from a file called /boot/kernel/kernel . . .


----------



## jasmine (Oct 4, 2010)

It queries running kernel. You can alter the output via environ()ment variables.

```
$ [man]ktrace[/man] -ty uname -a
FreeBSD raphael.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r213322 22d6ef5-dirty Fri Oct  1 19:43:24 UTC 2010   holo@raphael.local:/a/objdir/a/dirty_build/sys/PHOENIX  amd64
$ [man]kdump[/man]
 40948 uname    SCTL  "kern.ostype"
 40948 uname    SCTL  "kern.hostname"
 40948 uname    SCTL  "kern.osrelease"
 40948 uname    SCTL  "kern.version"
 40948 uname    SCTL  "hw.machine"
$ export UNAME_m= UNAME_n= UNAME_r= UNAME_s= UNAME_v=
$ ktrace -ty uname -a

$ kdump
$ unset UNAME_m UNAME_n UNAME_r UNAME_s UNAME_v
```


----------



## franklin321 (Aug 29, 2012)

Dear jasmine,

Nice post and you information, By the way, i would like to change holo@raphael.local to something else, how can i bring that change...kindly please help.


----------



## SirDice (Aug 29, 2012)

franklin321 said:
			
		

> By the way, I would like to change holo@raphael.local to something else, how can I bring that change?


It's the user account and hostname of the system that built the kernel.

NB. Please don't double post.


----------

