who(1) General Commands Manual who(1)Name
who - print who and where users are logged in
Syntax
who [who-file] [am i]
Description
The command, without an argument, lists the login name, terminal name, and login time for each current UNIX user.
Without an argument, examines the /etc/utmp file to obtain its information. If a file is given, that file is examined. Typically the
given file will be /usr/adm/wtmp, which contains a record of all the logins since it was created. Then lists logins, logouts, and crashes
since the creation of the wtmp file. Each login is listed with user name, terminal name (with /dev/ suppressed), and date and time. When
an argument is given, logouts produce a similar line without a user name. Reboots produce a line with `~' in the place of the device name,
and a fossil time indicative of when the system went down.
With two arguments, as in `who am I' (and also `who are you'), tells who you are logged in as.
Files
/etc/utmp
See Alsogetuid(2), utmp(5)who(1)
Check Out this Related Man Page
UTMP(5) File Formats Manual UTMP(5)NAME
utmp, wtmp - logged in users, login and logout history
SYNOPSIS
#include <sys/types.h>
#include <utmp.h>
DESCRIPTION
The files /etc/utmp and /usr/adm/wtmp respectively contain the currently logged in users, and the history of logins and logouts.
Each file is an array of the following structure defined in <utmp.h>:
struct utmp {
char ut_user[8]; /* user name */
char ut_line[12]; /* terminal name */
char ut_host[16]; /* host name, when remote */
time_t ut_time; /* login/logout time */
};
#define ut_name ut_user/* for compatibility with other systems */
The structure contains more fields than those listed, but they are only of interest to init and login. Note that the ut_name field is a
compatibility alias for ut_user, it is actually better to use it.
A login entry is completely specified. A logout entry has a null string for ut_name. A shutdown or reboot entry has an ut_line field con-
taining a "~" (tilde). The ut_name field is usually the name of the program that did the shutdown, or "reboot" at reboot. This is a bit
confusing, but note that there should always be two such entries. If you see just one entry then the system has crashed, if you see two
entries then the system was properly shut down and later rebooted.
FILES
/etc/utmp Currently logged in users.
/usr/adm/wtmp History of logins and logouts.
SEE ALSO who(1), ttyslot(3).
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
UTMP(5)
Hello All,
I want to build some monitoring of processes in HP-UX 11.x.
Is there any way to get the whole set of commands and arguments instead of the first 60 characters? I read that there's a limitation of the ps -ef command that we can't overcome. In this case is there any other command... (17 Replies)
Hi,
Can any one please let me know the code for implementing
who | sort | lp
Basically I want to implent pipe here. The program can use the existing who, sort and lp
Also please let me know How many processes are created in Unix when the following commands are executed?
$ ls... (17 Replies)
Hi,
I have this line in a file called test.cfg
SOURCEFILE=/usr/platform/sun4v/driver/file.cfg
But i have many occurances of "SOURCEFILE" in test.cfg , i need to search only for this line and replace that line with
SOURCEFILE=/usr/platform/sun4x/driver/file.cfg
again there are many... (17 Replies)
Hi All
I have a ksh script, which is run as the root user. At some point in the script, it needs to check for the user that is running the script. ( The real user that su to root). This is on a sol 8 server, but it displays the user as root instead of my username.
root@host-1 # who am i |... (19 Replies)
Hi Experts,
I am very new to scripting and have a prb since few days and it is urgent to solve so much appreciated if u help me.
i have 2 files
file1.txt
9647810043118
9647810043126
9647810043155
9647810043161
9647810043166
9647810043185
9647810043200
9647810043203
9647810043250... (22 Replies)
I am using 'dd' to clone an entire hard drive which only has Ubuntu 11.10 and some data with no special options. The disks are both 1Tb, However, I did re-partition the target disk with gparted successfully. The new partions are not the same size as the source disk. When starting 'dd' no partitions... (24 Replies)