* Last command output format
@ 2004-02-26 14:31 Claude
2004-02-27 17:13 ` Peter da Silva
0 siblings, 1 reply; 3+ messages in thread
From: Claude @ 2004-02-26 14:31 UTC (permalink / raw)
Bonjour,
I would like to know if it is possible to reformat the output
generated by the last command?
The host field is truncated to 16 char where in fact it is a 256 char
field. My host names are longer than 16 characters.
Is there another command I can use (perl script maybe) ?
Regards,
Claude.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Last command output format
2004-02-26 14:31 Last command output format Claude
@ 2004-02-27 17:13 ` Peter da Silva
2004-02-27 22:51 ` Brian Haley
0 siblings, 1 reply; 3+ messages in thread
From: Peter da Silva @ 2004-02-27 17:13 UTC (permalink / raw)
In article <9bc9c9cd.0402260631.3ca837fa@posting.google.com>,
Claude <claude.plouffe@ec.gc.ca> wrote:
> I would like to know if it is possible to reformat the output
> generated by the last command?
The "last" command dumps out records from the file "/var/adm/wtmp". These
records are in "utmp" format.
% man utmp
[...]
The utmp file records information about who is currently using the system.
The file is a sequence of utmp entries, as defined in struct utmp in the
utmp.h file.
[...]
% cat /usr/include/utmp.h
[...]
struct utmp {
char ut_user[32]; /* User login name */
char ut_id[14]; /* /etc/inittab id- IDENT_LEN in init */
char ut_line[32]; /* device name (console, lnxx) */
short ut_type; /* type of entry */
[...]
time_t ut_time; /* time entry was made */
char ut_host[64]; /* host name same as MAXHOSTNAMELEN */
};
> The host field is truncated to 16 char where in fact it is a 256 char
> field. My host names are longer than 16 characters.
64 char, actually.
> Is there another command I can use (perl script maybe) ?
That should be enough to get you started.
--
I've seen things you people can't imagine. Chimneysweeps on fire over the roofs
of London. I've watched kite-strings glitter in the sun at Hyde Park Gate. All
these things will be lost in time, like chalk-paintings in the rain. `-_-'
Time for your nap. | Peter da Silva | Har du kramat din varg, idag? 'U`
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Last command output format
2004-02-27 17:13 ` Peter da Silva
@ 2004-02-27 22:51 ` Brian Haley
0 siblings, 0 replies; 3+ messages in thread
From: Brian Haley @ 2004-02-27 22:51 UTC (permalink / raw)
Peter da Silva wrote:
> struct utmp {
> char ut_user[32]; /* User login name */
> char ut_id[14]; /* /etc/inittab id- IDENT_LEN in init */
> char ut_line[32]; /* device name (console, lnxx) */
> short ut_type; /* type of entry */
> [...]
> time_t ut_time; /* time entry was made */
> char ut_host[64]; /* host name same as MAXHOSTNAMELEN */
> };
This was changed to 256 some time ago (1997 ?).
>>The host field is truncated to 16 char where in fact it is a 256 char
>>field. My host names are longer than 16 characters.
The 'last' command uses a %16s modifier to print the hostname, probably
to make a nice table. Perhaps you could open a problem report to add a
flag (-l for long) to print the full name? It might be hard to change
the default since that might break someone else's existing script.
Or perhaps you are feeling daring and want to pull the FreeBSD source
for last.c and modify it :)
-Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-02-27 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-26 14:31 Last command output format Claude
2004-02-27 17:13 ` Peter da Silva
2004-02-27 22:51 ` Brian Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox