What is sysctl in some Unix-like Operating systems ?

ABOUT sysctl

sysctl is a software utility of some Unix-like operating systems that reads and modifies the attributes of the system kernel such as its version number, maximum limits, and security settings. It is available both as a system call for compiled programs, and an administrator command for interactive use and scripting. Linux additionally exposes sysctl as a virtual file system.

RELATED SHELL EXPOSURE
[bash]
$pwd
/proc/sys/kernel
$cat hung_task_timeout_secs
120
$sudo sysctl kernel.hung_task_timeout_secs 121
[sudo] password for jeffrin:
kernel.hung_task_timeout_secs = 120
sysctl: cannot stat /proc/sys/121: No such file or directory
$sudo sysctl kernel.hung_task_timeout_secs="121"
kernel.hung_task_timeout_secs = 121
$cat hung_task_timeout_secs
121
$sudo sysctl kernel.hung_task_timeout_secs="120"
kernel.hung_task_timeout_secs = 120
$cat hung_task_timeout_secs
120
$

[/bash]

[bash collapse=”true”]
root@debian:~# cd /proc/sys
root@debian:/proc/sys# grep . kernel/*
kernel/acct:4 2 30
kernel/acpi_video_flags:0
kernel/auto_msgmni:1
kernel/blk_iopoll:1
kernel/bootloader_type:114
kernel/bootloader_version:2
kernel/cad_pid:1
kernel/compat-log:1
kernel/core_pattern:core
kernel/core_pipe_limit:0
kernel/core_uses_pid:0
kernel/ctrl-alt-del:0
kernel/dmesg_restrict:0
kernel/domainname:(none)
kernel/ftrace_dump_on_oops:0
kernel/hostname:debian
kernel/hung_task_check_count:4194304
kernel/hung_task_panic:0
kernel/hung_task_timeout_secs:120
kernel/hung_task_warnings:10
kernel/io_delay_type:0
grep: kernel/keys: Invalid argument
kernel/kptr_restrict:0
kernel/kstack_depth_to_print:12
kernel/max_lock_depth:1024
kernel/modprobe:/sbin/modprobe
kernel/modules_disabled:0
kernel/msgmax:8192
kernel/msgmnb:16384
kernel/msgmni:3893
kernel/ngroups_max:100536
kernel/nmi_watchdog:1
kernel/osrelease:3.1.0-1-amd64
kernel/ostype:Linux
kernel/overflowgid:100534
kernel/overflowuid:100534
kernel/panic:0
kernel/panic_on_io_nmi:0
kernel/panic_on_oops:0
kernel/panic_on_unrecovered_nmi:0
kernel/perf_event_max_sample_rate:100000
kernel/perf_event_mlock_kb:516
kernel/perf_event_paranoid:1
kernel/pid_max:32768
kernel/poweroff_cmd:/sbin/poweroff
kernel/print-fatal-signals:0
kernel/printk:4 4 1 7
kernel/printk_delay:0
kernel/printk_ratelimit:5
kernel/printk_ratelimit_burst:10
grep: kernel/pty: Invalid argument
grep: kernel/random: Invalid argument
kernel/randomize_va_space:2
kernel/real-root-dev:0
kernel/sched_autogroup_enabled:0
kernel/sched_child_runs_first:0
grep: kernel/sched_domain: Invalid argument
kernel/sched_latency_ns:6000000
kernel/sched_migration_cost:500000
kernel/sched_min_granularity_ns:750000
kernel/sched_nr_migrate:32
kernel/sched_rt_period_us:1000000
kernel/sched_rt_runtime_us:950000
kernel/sched_shares_window:10000000
kernel/sched_time_avg:1000
kernel/sched_tunable_scaling:1
kernel/sched_wakeup_granularity_ns:1000000
kernel/sem:250 32000 32 128
kernel/shmall:2097152
kernel/shmmax:33554432
kernel/shmmni:4096
kernel/shm_rmid_forced:0
kernel/softlockup_panic:0
kernel/sysrq:438
kernel/tainted:4097
kernel/threads-max:30982
kernel/timer_migration:1
kernel/unknown_nmi_panic:0
grep: kernel/usermodehelper: Invalid argument
kernel/version:#1 SMP Fri Dec 23 16:37:11 UTC 2011
kernel/watchdog:1
kernel/watchdog_thresh:10
root@debian:/proc/sys#

[/bash]

RELATED LINKS
https://en.wikipedia.org/wiki/Sysctl
http://man7.org/linux/man-pages/man8/sysctl.8.html
https://www.linuxjournal.com/article/2365
https://dl.acm.org/citation.cfm?id=326974
https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s