- $ who
- mc pts/2 Sep 12 14:29 (sulaco.mcslp.pri)
- mcbrown pts/3 Sep 12 14:37 (nautilus.mcslp.pri)
- $ who -q
- mc mcbrown
- # users=2
- $ users
- mc mcbrown
- $ who -aH
- NAME LINE TIME IDLE PID COMMENTS
- . system boot Sep 12 11:35
- . run-level 3 Sep 12 11:35 3 0 S
- zsmon . Sep 12 11:35 3:14 215
- LOGIN console Sep 12 11:35 0:20 221
- LOGIN console Sep 12 11:35 0:20 510 (:0)
- mc + pts/2 Sep 12 14:29 . 569 (sulaco.mcslp.pri)
- mcbrown + pts/3 Sep 12 14:37 0:12 675 (nautilus.mcslp.pri)
- $ rwho -a
- mc solaris-desktop:console Sep 12 11:29 3:41
- mc solaris-desktop:pts/1 Sep 12 11:32 :06
- mc ultra3:pts/2 Sep 12 14:29
- mcbrown ultra3:pts/3 Sep 12 14:37 :37
- M
- $ rusers
- Sending broadcast for rusersd protocol version 3...
- 192.168.0.31 mc mcbrown
- solaris-desktop. mc mc
- $ ruptime
- solaris-desktop up 3:53, 1 user, load 0.00, 0.00, 0.00
- ultra3 up 3:46, 2 users, load 0.00, 0.00, 0.00
- struct lastlog {
- time_t ll_time;
- char ll_line[UT_LINESIZE];
- char ll_host[UT_HOSTSIZE];
- };
- struct utmp
- {
- char ut_user[8];
- char ut_id[14]
- char ut_line[12];
- short ut_type;
- pid_t ut_pid;
- struct exit_status
- {
- short e_termination;
- short e_exit;
- }
- #define EMPTY 0
- #define RUN_LVL 1
- #define BOOT_TIME 2
- #define OLD_TIME 3
- #define NEW_TIME 4
- #define INIT_PROCESS 5
- #define LOGIN_PROCESS 6
- #define USER_PROCESS 7
- #define DEAD_PROCESS 8
- #define ACCOUNTING 9
- #define UTMAXTYPE ACCOUNTING
- struct utmp {
- char ut_line[UT_LINESIZE];
- char ut_name[UT_NAMESIZE];
- char ut_host[UT_HOSTSIZE];
- time_t ut_time;
- };
- #define UT_UNKNOWN 0
- #define RUN_LVL 1
- #define BOOT_TIME 2
- #define NEW_TIME 3
- #define OLD_TIME 4
- #define INIT_PROCESS 5
- #define LOGIN_PROCESS 6
- #define USER_PROCESS 7
- #define DEAD_PROCESS 8
- #define ACCOUNTING 9
- struct utmp {
- short ut_type; /* type of login */
- pid_t ut_pid; /* PID of login process */
- char ut_line[UT_LINESIZE]; /* device name of tty - "/dev/" */
- char ut_id[4]; /* init id or abbrev. ttyname */
- char ut_user[UT_NAMESIZE]; /* user name */
- char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
- struct exit_status ut_exit; /* The exit status of a process
- marked as DEAD_PROCESS */
- /* The ut_session and ut_tv fields must be the same size when
- compiled 32- and 64-bit. This allows data files and shared
- memory to be shared between 32- and 64-bit applications */
- #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
- int32_t ut_session; /* Session ID, used for windowing */
- struct {
- int32_t tv_sec; /* Seconds */
- int32_t tv_usec; /* Microseconds */
- } ut_tv; /* Time entry was made */
- #else
- long int ut_session; /* Session ID, used for windowing */
- struct timeval ut_tv; /* Time entry was made */
- #endif
- int32_t ut_addr_v6[4]; /* IP address of remote host */
- char __unused[20]; /* Reserved for future use */
- };
- $ last
- statmon ftp nautilus.mcslp.p Wed Sep 12 15:50 - 15:50 (00:00)
- statmon ftp narcissus.mcslp. Wed Sep 12 15:50 - 15:50 (00:00)
- statmon ftp nostromo.mcslp.p Wed Sep 12 15:50 - 15:50 (00:00)
- statmon ftp sulaco.mcslp.pri Wed Sep 12 15:49 - 15:49 (00:00)
- statmon ftp nautilus.mcslp.p Wed Sep 12 15:45 - 15:45 (00:00)
- statmon ftp nostromo.mcslp.p Wed Sep 12 15:45 - 15:45 (00:00)
- statmon ftp narcissus.mcslp. Wed Sep 12 15:45 - 15:45 (00:00)
- $ last root
- root console :0 Mon Sep 25 11:32 - 11:32 (00:00)
- root console :0 Mon Sep 25 11:27 - 11:27 (00:00)
- root console Sat Sep 9 13:17 - 13:28 (00:11)
- root console Sat Sep 9 10:47 - 13:14 (02:26)
- root console Sun Sep 3 06:52 - down (6+03:54)
- root console :0 Sat Sep 2 14:24 - down (16:27)
- root console Sat Sep 2 08:02 - down (06:13)
- root console Fri Aug 25 17:16 - down (00:39)
- root console Sun Aug 20 16:04 - 16:04 (00:00)
- root console Thu Jul 20 07:23 - 07:31 (00:07)
- root console Thu Jul 20 07:22 - 07:23 (00:00)
- root console Thu Jul 20 02:57 - 02:57 (00:00)
- root console Wed Jul 19 12:22 - down (05:38)
- root console Wed Jul 19 12:10 - 12:19 (00:08)
- root console :0 Wed Jul 19 12:05 - 12:09 (00:04)
- root console Wed Jul 19 11:47 - 11:55 (00:07)
- wtmp begins Wed Jul 19 09:54
- $ last reboot
- reboot system boot Wed Sep 12 11:28
- reboot system down Wed Sep 5 12:16
- reboot system boot Mon Sep 3 13:03
- reboot system down Thu Mar 1 11:33
- reboot system boot Thu Mar 1 09:57
- reboot system down Thu Mar 1 08:12
- reboot system boot Thu Mar 1 08:05
- reboot system down Thu Mar 1 08:12
- reboot system boot Thu Mar 1 08:05
- reboot system down Thu Mar 1 08:03
- reboot system boot Thu Mar 1 08:02
- reboot system down Sun Dec 17 10:04
- reboot system boot Sun Dec 17 10:02
- reboot system down Mon Sep 25 11:44
- reboot system boot Mon Sep 25 10:2
- my $packstring = "a8a8a8ssssl";
- my $reclength = length(pack($packstring));
- my @ut_types = qw(EMPTY RUN_LVL BOOT_TIME OLD_TIME
- NEW_TIME INIT_PROCESS LOGIN_PROCESS
- USER_PROCESS DEAD_PROCESS ACCOUNTING);
- open(D,"</var/log/wtmp") or die "Couldn't open wtmp, $!";
- while(sysread(D,my $rec,$reclength))
- {
- my ($user,$userid,$line,$pid,$type,$eterm,$eexit,$time)
- = unpack($packstring,$rec);
- print("$user, $userid, $line, $pid, $ut_types[$type], ",
- "$eterm, $eexit, ", scalar localtime($time),"\n");
- }
- close(D) or die "Couldn't close wtmp, $!";
- #define UT_NAMESIZE 8
- #define UT_LINESIZE 8
- #define UT_HOSTSIZE 16
- my $packstring = "a8a8a16l";
- my $reclength = length(pack($packstring));
- my @ut_types = qw(EMPTY RUN_LVL BOOT_TIME OLD_TIME
- NEW_TIME INIT_PROCESS LOGIN_PROCESS
- USER_PROCESS DEAD_PROCESS ACCOUNTING);
- open(D,"</var/log/wtmp") or die "Couldn't open wtmp, $!";
- while(sysread(D,my $rec,$reclength))
- {
- my ($line,$name,$host,$time)
- = unpack($packstring,$rec);
- print("$line, $name, $host,", scalar localtime($time),"\n");
- }
- close(D) or die "Couldn't close wtmp, $!";
- ftp599, statmon, nautilus.mcslp.p,Wed Sep 12 16:00:13 2007
- ftp599, , ,Wed Sep 12 16:00:14 2007
- ftp4003, statmon, sulaco.mcslp.pri,Wed Sep 12 16:04:35 2007
- ftp4003, , ,Wed Sep 12 16:04:35 2007
- ftp4035, statmon, narcissus.mcslp.,Wed Sep 12 16:05:00 2007
- ftp4035, , ,Wed Sep 12 16:05:00 2007
- ftp4037, statmon, nostromo.mcslp.p,Wed Sep 12 16:05:01 2007
- ftp4037, , ,Wed Sep 12 16:05:02 2007
- ftp4057, statmon, nautilus.mcslp.p,Wed Sep 12 16:05:14 2007
- ftp4057, , ,Wed Sep 12 16:05:14 2007