Sys::Utmp::Utent(3pm)
π Sys::Utmp::Utent π
okay so bestie, welcome to Sys::Utmp::Utent β it's the little Perl module (User Contributed Perl Documentation, no cap) that hands you one single utmp entry as a precious lil object. one entry. one vibe. let's get into it π«Ά
β¨ NAME β¨
Sys::Utmp::Utent β represent a single utmp entry. that's it, that's the whole job π
π¦ SYNOPSIS π¦
use Sys::Utmp;
my $utmp = Sys::Utmp->new();
while ( my $utent = $utmp->getutent() )
{
if ( $utent->user_process )
{
print $utent->ut_user,"\n";
}
}
$utmp->endutent;
πΈ DESCRIPTION πΈ
so like, the Sys::Utmp docs already told you that getutent returns an object of type Sys::Utmp::Utent β and this is that object, bestie. it's giving you methods for accessing the fields in the utmp record, and it also has methods for figuring out what type of record you're looking at. main character energy all around β¨
the access methods line up with the common names for the members of the C struct utent β and the ones provided here are the superset from the Gnu implementation, which means they might legitimately not exist on every system. and when they don't? no drama, they just return the empty string. okurrr π
π ut_user
returns the user this record was created for β assuming it's a record for a user process. lowkey some systems might return other info depending on the record type, so don't be shocked. if no user was set, you get the empty string. and heads up: if tainting is switched on with the -T switch to perl, this value will be 'tainted', because it's genuinely possible the user name came from an untrusted source. π₯
π ut_id
the identifier for this record. it might be the inittab tag, or honestly just some other system dependent value. iykyk π
π ut_line
for user process records, this is the name of the terminal or line that the user is connected on π₯οΈβ¨
π ut_pid
the process ID of the process that created this record. literally just the pid, periodt.
π ut_type
the type of the record! it'll be a value matching one of these constants β though not all of them may be available on all systems, and there may well be others that get described in the getutent manpage or in /usr/include/utmp.h:
ACCOUNTINGβ record was created for system accounting purposes.BOOT_TIMEβ the record was created at boot time.DEAD_PROCESSβ the process that created this record has terminated.EMPTYβ record probably contains no other useful information.INIT_PROCESSβ this is a record for a process created by init.LOGIN_PROCESSβ this record was created for a login process (e.g.getty).NEW_TIMEβ record created when the system time has been set.OLD_TIMEβ record recording the old time when the system time has been set.RUN_LVLβ records the time at which the current run level was started.USER_PROCESSβ record created for a user process (e.g. a login).
for convenience, Sys::Utmp::Utent also hands you lower case versions of the constant names as methods β they return true if the record is of that type. so cute, so handy π
π ut_host
on systems that support this, the method returns the hostname of the host for which the process that created the record was started β like, for example, a telnet login π. and if taint checking has been turned on (with the -T switch to perl), then this value will be tainted, because it is possible that a remote user will be in control of the DNS for the machine they have logged in from. (see perlsec for more on tainting, bestie π)
π ut_time
the time in epoch seconds at which the record was created β°
π BUGS π
probably! π
this module has been tested on Linux, Solaris, FreeBSD, SCO Openserver and SCO UnixWare, and found to work on those platforms. so like, it's been around the block fr fr.
if you have difficulty building the module, or it doesn't behave as expected, then please contact the author β and include your /usr/include/utmp.h if that's appropriate. they want the receipts π§Ύβ¨
π AUTHOR π
Jonathan Stowe, <jns@gellyfish.co.uk>
π LICENCE π
this Software is Copyright Jonathan Stowe 2001-2013.
this Software is published as-is with no warranty express or implied. (say it with me: no warranty, periodt π )
this is free software and can be distributed under the same terms as Perl itself. slay π
π₯ SEE ALSO π₯
perl, Sys::Utmp
and that's the whole page, bestie!! this absolute icon of a manpage is from perl v5.42.3, dated 2026-08-19, and lives at Sys::Utmp::Utent(3pm) πβ¨π¦ go read your utmp records, you gorgeous nerd, and drink some water π«ΆπΈ
π¦ where this page comes from
- ubuntu stonking: libsys-utmp-perl 1.8-2build7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms