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 πŸ”₯

getutxent(3), wtmp(5)


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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms