updwtmp(3)
π updwtmp(3) β Library Functions Manual π
okay bestie, pull up a chair, we're talking about updwtmp and logwtmp β the little duo whose whole job is appending entries to the wtmp file. yes, that file. the "who logged in and when" receipt printer. no cap.
β¨ NAME β¨
updwtmp, logwtmp β append an entry to the wtmp file
π LIBRARY π
System utilities library (libutil, -lutil)
like, you gotta link the util library. <pink>don't forget the -lutil</pink>, she's right there in the name, iykyk.
πΈ SYNOPSIS πΈ
#include <utmp.h>
void updwtmp(const char *wtmp_path, const struct utmp *ut);
void logwtmp(const char *line, const char *user, const char *host);
π¦ DESCRIPTION π¦
so updwtmp() is the simple one. it takes that utmp structure β you know, the ut β and appends it to the wtmp file. that's it. that's the whole vibe. in, out, done. π
and logwtmp() is the one that does the ~crafting~. it builds a utmp structure all by itself using line, user, host, plus the current time and the current process ID π. then β and this is the iconic part β it calls updwtmp() to go append that freshly constructed structure to the wtmp file. she's giving main character energy that delegates. periodt.
π FILES π
/var/log/wtmpβ database of past user logins
the receipts. the archive. the "who was here before you" scroll. π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
updwtmp(),logwtmp()β Thread safety:MT-Unsafe sig:ALRM timer
β οΈ okay so heads up: MT-Unsafe sig:ALRM timer. that's not a cute little sticker, that's a real warning. read it, respect it, don't get got. π
β VERSIONS β
for consistency with the other <rainbow>"utmpx"</rainbow> functions (peep getutxent(3)), glibc has been providing this since glibc 2.1:
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <utmpx.h>
void updwtmpx (const char *wtmpx_path, const struct utmpx *utx);
and this function? does the exact same task as updwtmp(), with one β¨ twist β¨ β it takes a utmpx structure as its last argument instead. same energy, different struct. slay.
π STANDARDS π
None.
like literally none, don't come for her, she's doing her best. π
π§ HISTORY π§
Solaris, NetBSD.
she's got history. she's been around. iconic lineage honestly. πΈ
π₯ SEE ALSO π₯
and that's the whole page bestie!! π this was updwtmp(3) from the Linux man-pages 6.20, dated 2026-02-08 β go log something into /var/log/wtmp and live your truth. π«Άβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 1997, NicolΓ‘s Lichtmaier <nick@debian.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms