我的系统:Linux/Lubuntu 18.04 LTS,64 位
我想做的是用终端命令检查我的交换价值
sysctl vm.swappiness
纯粹出于笨拙,我只打字
sysctl vm
并击中Enter。
问题是:我毕竟得到了输出:
rosika@rosika-Lenovo-H520e ~> sysctl vm
vm.admin_reserve_kbytes = 8192
vm.block_dump = 0
vm.compact_unevictable_allowed = 1
vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 10
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 3000
vm.dirty_ratio = 20
vm.dirty_writeback_centisecs = 500
vm.dirtytime_expire_seconds = 43200
vm.drop_caches = 0
vm.extfrag_threshold = 500
vm.hugepages_treat_as_movable = 0
vm.hugetlb_shm_group = 0
vm.laptop_mode = 0
vm.legacy_va_layout = 0
vm.lowmem_reserve_ratio = 256 256 32 1
vm.max_map_count = 65530
vm.memory_failure_early_kill = 0
vm.memory_failure_recovery = 1
vm.min_free_kbytes = 67584
vm.min_slab_ratio = 5
vm.min_unmapped_ratio = 1
vm.mmap_min_addr = 65536
sysctl: Zugriff verweigert auf Schlüssel »vm.mmap_rnd_bits«
sysctl: Zugriff verweigert auf Schlüssel »vm.mmap_rnd_compat_bits«
vm.nr_hugepages = 0
vm.nr_hugepages_mempolicy = 0
vm.nr_overcommit_hugepages = 0
vm.numa_stat = 1
vm.numa_zonelist_order = Node
vm.oom_dump_tasks = 1
vm.oom_kill_allocating_task = 0
vm.overcommit_kbytes = 0
vm.overcommit_memory = 0
vm.overcommit_ratio = 50
vm.page-cluster = 3
vm.panic_on_oom = 0
vm.percpu_pagelist_fraction = 0
vm.stat_interval = 1
sysctl: Zugriff verweigert auf Schlüssel »vm.stat_refresh«
vm.swappiness = 60
vm.user_reserve_kbytes = 121890
vm.vfs_cache_pressure = 100
vm.watermark_scale_factor = 10
vm.zone_reclaim_mode = 0
rosika@rosika-Lenovo-H520e ~> echo $status
255
然而,如您所见,我得到了退出代码 255。
那么有人可以告诉我我做了什么吗?我希望这毕竟不是太愚蠢的事情。
AFAIK 你的所有命令都是从命名空间打印每一
variable = value
对,/proc/sys/vm
而不是仅仅打印vm.swappiness
- 基本上相当于 donecat /proc/sys/vm/*
而不是cat /proc/sys/vm/swappiness
.要实际更改任何参数,您需要添加
-w
或--write
(并指定一个特定的,并且可能还提升了您的权限)。