pavement

Sysctl

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
'''sysctl''' is used to get/set various kernel and kernel module parameters
+
'''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 net.link.ether.bridge=0'''
 +
net.link.ether.bridge: 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
  
 
[[Category:System Commands]]
 
[[Category:System Commands]]

Revision as of 10:49, 27 July 2005

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 net.link.ether.bridge=0
net.link.ether.bridge: 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
Personal tools