From FreeBSDwiki
Jump to: navigation, search

sysctl is used to get/set various kernel and kernel module parameters.

To get the value of a kernel parameter:

[root@splat ~]# sysctl hw.physmem
hw.physmem: 130453504

To set the value of a kernel parameter:

[root@splat ~]# sysctl 1 -> 0

Please note that some parameters are read-only and cannot be changed.

You can use the -a parameter to list all sysctl variables. Coupled with grep this makes a great way to find the sysctl variable you're looking for.

[root@splat ~]# sysctl -a | grep mem
vm.zone_kmem_pages: 182
vm.zone_kmem_kvaspace: 14725120
vfs.ufs.dirhash_maxmem: 2097152
vfs.ufs.dirhash_mem: 292312
hw.physmem: 130453504
hw.usermem: 107544576

Be careful when editing sysctl values. Invalid or incorrect settings could cause severe problems with your system.

Personal tools