Pretty print all of the Linux vm sysctls for your viewing pleasure

find /proc/sys/vm -maxdepth 1 -type f | while read i ; do printf "%-35s\t%s\n" "$i" "$(<$i)" ; done | sort -t/ -k4
Sometimes you want to see all of the systcls for a given $thing. I happened to need to easily look at all of the vm sysctls between two boxes and compare them. This is what I came up with.
Sample Output
/proc/sys/vm/block_dump            	0
/proc/sys/vm/dirty_background_bytes	0
/proc/sys/vm/dirty_background_ratio	5
/proc/sys/vm/dirty_bytes           	0
/proc/sys/vm/dirty_expire_centisecs	3000
/proc/sys/vm/dirty_ratio           	10
/proc/sys/vm/dirty_writeback_centisecs	500
/proc/sys/vm/drop_caches           	0
/proc/sys/vm/hugepages_treat_as_movable	0
/proc/sys/vm/hugetlb_shm_group     	0
/proc/sys/vm/laptop_mode           	0
/proc/sys/vm/legacy_va_layout      	0
/proc/sys/vm/lowmem_reserve_ratio  	256	256	32
/proc/sys/vm/max_map_count         	65530
... snip ...

0
By: SEJeff
2012-05-25 16:34:16

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: