{"id":12072,"date":"2021-11-18T05:42:34","date_gmt":"2021-11-18T05:42:34","guid":{"rendered":"https:\/\/linuxways.net\/?p=12072"},"modified":"2024-03-25T02:10:32","modified_gmt":"2024-03-25T02:10:32","slug":"sysctl-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/sysctl-command-in-linux\/","title":{"rendered":"sysctl command in Linux"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>If you are a Linux system administrator, it is essential to modify the behavior of the default kernel. For example, you can make the Kernel accept an increase in the number of connections. Kernels can operate on the interface between the hardware and the operating system but the user cannot be executable with the kernel.<\/p>\n<p>And we will show you how to use the sysctl command in Linux as you go through it below. Hope you understand.<\/p>\n<h2><a id=\"post-12072-_nbdnvz3hvxok\"><\/a>Relationship between kernel and Sysctl<\/h2>\n<p>1. Each kernel works with a certain parameter<\/p>\n<p>2. Kernels work with system resources and they can change over time<\/p>\n<p>3. The change of the resource causes the kernel parameters to change as well<\/p>\n<p>4. You can manage kernel configuration and parameters by using the sysctl command<\/p>\n<p>5. We can modify kernel configuration and parameters at runtime by using the sysctl command<\/p>\n<h2>Check all the Kernel Parameters<\/h2>\n<p>Run sysctl command with option -a:<\/p>\n<pre>\r\n$ sysctl -a\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"464\" class=\"wp-image-12074\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-267.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-267.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-267-300x134.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-267-1024x456.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-267-768x342.png 768w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<h2><a id=\"post-12072-_mfbfulaozt2e\"><\/a>Check for a specific single Kernel Parameter<\/h2>\n<p>Run the sysctl command with the kernel you need to test. For example, I will check vm.page-cluster kernel:<\/p>\n<pre>\r\n$ sysctl vm.page-cluster\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1041\" height=\"75\" class=\"wp-image-12075\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-268.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-268.png 1041w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-268-300x22.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-268-1024x74.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-268-768x55.png 768w\" sizes=\"auto, (max-width: 1041px) 100vw, 1041px\" \/><\/p>\n<p>If you want to show only the parameter value, add the -n option:<\/p>\n<pre>\r\n$ sysctl -n vm.page-cluster\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"67\" class=\"wp-image-12076\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269-300x19.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269-1024x66.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269-768x49.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-269-1020x67.png 1020w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<h2><a id=\"post-12072-_yccpjbi2wicp\"><\/a>Sysctl command combined with grep command<\/h2>\n<p>For example, I show only those kernels that start with vm:<\/p>\n<pre>\r\n$ sysctl -a | grep vm\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"626\" class=\"wp-image-12077\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270-300x180.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270-1024x615.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270-768x461.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-270-501x300.png 501w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<h2><a id=\"post-12072-_ul8dmizi81y2\"><\/a>Set up the value of the parameter<\/h2>\n<p>The syntax:<\/p>\n<pre>\r\n$ sysctl -w parameter=value\r\n<\/pre>\n<p>For example, I want to set up the value of vm.page-cluster as 2:<\/p>\n<pre>\r\n$ sysctl -w vm.page-cluster=2\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"107\" class=\"wp-image-12078\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-271.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-271.png 1043w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-271-300x31.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-271-1024x105.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-271-768x79.png 768w\" sizes=\"auto, (max-width: 1043px) 100vw, 1043px\" \/><\/p>\n<h2><a id=\"post-12072-_ar9t6y5nzr9q\"><\/a>Conclusion<\/h2>\n<p>Above is the tutorial about how to use the sysctl command in Linux through examples.<\/p>\n<p>Thanks for reading!<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction If you are a Linux system administrator, it is essential to modify the behavior of the default kernel. For example, you can make the Kernel accept an&hellip;<\/p>","protected":false},"author":110,"featured_media":12079,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,5,168,2],"tags":[361],"class_list":["post-12072","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-mint","category-scripting","category-ubuntu","tag-linux-commands"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12072"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12072\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12079"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}