<p>Here is a script that removes the oldest entries in the /var/adm/wtmp file, but keeps a reasonable history:</p>{"id":153,"date":"2009-06-19T14:44:19","date_gmt":"2009-06-19T18:44:19","guid":{"rendered":"http:\/\/patrickv.info\/wordpress\/?p=153"},"modified":"2009-06-19T14:44:19","modified_gmt":"2009-06-19T18:44:19","slug":"clean-the-wtmp-file","status":"publish","type":"post","link":"https:\/\/rootuser.ninja\/index.php\/2009\/06\/19\/clean-the-wtmp-file\/","title":{"rendered":"Clean the wtmp file"},"content":{"rendered":"<p>Here is a script that removes the oldest entries in the \/var\/adm\/wtmp file, but keeps a reasonable history:<br \/>\n<!--more--><\/p>\n<pre><code>#!\/bin\/sh\n\n\/usr\/sbin\/acct\/fwtmp &lt; \/var\/adm\/wtmp | tail -25000 &gt; \/tmp\/wtmp.ascii.new\nif [ \"$?\" != 0 ]\nthen\n\u00a0 \u00a0 \u00a0 \u00a0 echo \"$0\" \"Error extracting wtmp file\"\n\u00a0 \u00a0 \u00a0 \u00a0 exit\nfi\n\n\/usr\/sbin\/acct\/fwtmp -ic &lt; \/tmp\/wtmp.ascii.new &gt; \/var\/adm\/wtmp\nif [ \"$?\" != 0 ]\nthen\n\u00a0 \u00a0 \u00a0 \u00a0 echo \"$0\" \"Error recompressing wtmp file\"\n\u00a0 \u00a0 \u00a0 \u00a0 exit\nelse\n\nrm \/tmp\/wtmp.ascii.new\n\nfi<\/code><\/pre>\n<p>This could be done on in a one-liner, but this gives a little more feedback if it fails, which I&#8217;ve never actually seen.<\/p>","protected":false},"excerpt":{"rendered":null,"protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,1],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","hentry","category-aix-notes","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":0,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"wp:attachment":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}