ULOG

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXPRESSIONS
SORT KEYS
ENVIRONMENT VARIABLES
SEE ALSO
AUTHOR

NAME

ulog − search for X users logged in

SYNOPSIS

ulog [options] [--] [expression]

DESCRIPTION

ulog searches for X users logged in. The search may be according to an optional expression which syntax is very similar to the one of the "find" command. This expression is evaluated from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point ulog moves on to the next user.

Options must be the first arguments, and can optionaly be separated from the expression by --. If no NIS domains are given, the current domain is used. If no expression is given, the expression ‘−print’ is used.

ulog exits with status 0 if at least one user matches the given criteria, with status 1 if there was no match, and with status 2 if an error occured.

OPTIONS

-c, --config file

Use an alternate configuration file.

-e, --event description

Notify an event concerning an X session to the server. This can be a login, a logout, or the restart of the X server. Syntax is -e type[,user=username][,display=displayname:id][,host=hostname][,nis=nisdomainname]. type can be login, logout, or restart. All other parameters are optional. user is the logname of the X session owner which is related to the event. If no user is provided, the environment variable USER is used. displayname is the display on which the event occurs. Of course, display must be followed by its number. If no display is provided, the environment variable DISPLAY is used. hostname is the host whose X server is queried. If no hostname is provided, current system hostname is used. nisdomainname is the NIS domainname of the host whose X server is queried. If no domainname is provided, current system NIS domainname is used, if available.

-f, --follow

‘‘Follow’’ mode. The program will not terminate after all current entries have been displayed, but will enter an endless passive loop, wherein it waits for new events. Thus it may be used to monitor real-time logins/logouts.

-i, --interactive

Interactive mode. The program will not terminate after all current entries have been displayed. A little interactive shell is launched.

-p, --port port

Use an alternate port number.

-q, --quiet

Do not display current entries at first invocation. Especially useful with interactive and/or follow modes.

-s, --server server

Use alternate server.

-v, --verbose verbose

Be verbose about network data.

--sort type

Specify output sort order according to the multilevel sort specified by the sequence of keys key1, key2, ... Syntax is --sortX[+|-]key1[,[+|-]key2[,...]]. Choose a key from the SORT KEYS section. ‘X’ may be any convenient separator character : space is allowed, but you can also use ‘=’ to be GNU-ish. ‘-’ reverses direction only on the key it precedes. The ‘+’ is really optional since default direction is increasing numerical or lexicographic order. For example ulog --sort=host,-date sorts according to hostname, then reverse login time (for a given host). If one of the keys is ‘none’, the output is not sorted. If no sort criteria is given, output is sorted by user.

-V, --version

Print the ulog version number and configuration details to stdout and exit.

-?, --help

Print a summary of the command-line usage of ulog and exit.

EXPRESSIONS

The expression is made up of options (which affect overall operation rather than the processing of a specific user, and always return true), tests (which return a true or false value), and actions (which have side effects and return a true or false value), all separated by operators. −and is assumed where the operator is omitted. If the expression contains no actions, −print is performed on all users for which the expression is true.

OPTIONS

All options always return true. They always take effect, rather than being processed only when their place in the expression is reached. Therefore, for clarity, it is best to place them at the beginning of the expression.

−daystart

Measure times from the beginning of today rather than from 24 hours ago.

TESTS

Numeric arguments can be specified as

+n

for greater than n,

−n

for less than n,

n

for exactly n.

-d, -disp dispname

User is logged on display matching shell pattern dispname.

−false

Always false.

-fn pattern

The user’s full name (the field of the passwd file) matches shell pattern pattern.

-g, -group gname

User belongs to group gname (numeric group ID allowed).

-h, -host hostname

User is logged on host matching shell pattern hostname.

-ifn pattern

Like −fn, but the match is case insensitive. For example, the patterns ‘fo*’ and ‘F??’ match the full names ‘Foo’, ‘FOO’, ‘foo’, ‘fOo’, etc.

-imin n

User logged in n minutes ago.

-itime n

User logged in n*24 hours ago.

-nick nickname

The user’s nickname is nickname.

-n, -domain domainname

The host belongs to ’virtual’ domain domainname.

−true

Always true.

-type type

The type of event is ‘login’ or ‘logout’.

-u, -user username

User matches shell pattern username (numeric user ID allowed).

-ug, -usergroup usergroup

User belongs to usergroup usergroup. A usergroup is a group which can be defined in ~/.ulogrc (see ulog.conf(5)).

ACTIONS

-exec command ;

Execute command; true if 0 status is returned. All following arguments to ulog are taken to be arguments to the command until an argument consisting of ‘;’ is encountered.

-fls file

True; like −ls but write to file like −fprint.

-fprint file

True; print the full log entry into file file. If file does not exist when ulog is run, it is created; if it does exist, it is truncated. The file names ‘‘/dev/stdout’’ and ‘‘/dev/stderr’’ are handled specially; they refer to the standard output and standard error output, respectively.

-fprint0 file

True; like −print0 but write to file like −fprint.

-fprintf file format

True; like −printf but write to file like −fprint.

-ok command ;

Like −exec but asks the user first (on the standard input); if the response does not start with ‘y’ or ‘Y’, do not run the command, and return false.

−print

True; print the full log entry on the standard output, followed by a newline.

−print0

True; print the full log entry on the standard output, followed by a null character. This allows log entries that contain newlines to be correctly interpreted by programs that process the ulog output.

-printf format

True; print format on the standard output, interpreting ‘\’ escapes and ‘%’ directives. Field widths and precisions can be specified as with the ‘printf’ C function. Unlike −print, −printf does not add a newline at the end of the string. The escapes and directives are:

\a

Alarm bell.

\b

Backspace.

\c

Stop printing from this format immediately and flush the output.

\f

Form feed.

\n

Newline.

\r

Carriage return.

\t

Horizontal tab.

\v

Vertical tab.

\\

A literal backslash (‘\’).

A ‘\’ character followed by any other character is treated as an ordinary character, so they both are printed.

%%

A literal percent sign.

%d

Display name (in short form if possible) and number separated by a colon.

%D

Display name (in long form) and number separated by a colon.

%e

Display name (in short form if possible) only.

%E

Display name (in long form) only.

%f

User’s full name (from the passwd entry).

%g

User’s group name, or numeric group ID if the group has no name.

%G

User’s numeric group ID.

%h

Host name (in short form if possible).

%H

Host name (in long form).

%l

Login type (login, logout).

%n

Virtual domain name of the host.

%N

Display number only.

%t

Event (login/logout) time in the format returned by the C ‘ctime’ function.

%Tk

Event (login/logout) time in the format specified by k, which is either ‘@’ or a directive for the C ‘strftime’ function. The possible values for k are listed below; some of them might not be available on all systems, due to differences in ‘strftime’ between systems.

@

seconds since Jan. 1, 1970, 00:00 GMT.

Time fields:

H

hour (00..23)

I

hour (01..12)

k

hour ( 0..23)

l

hour ( 1..12)

M

minute (00..59)

p

locale’s AM or PM

r

time, 12-hour (hh:mm:ss [AP]M)

S

second (00..61)

T

time, 24-hour (hh:mm:ss)

X

locale’s time representation (H:M:S)

Z

time zone (e.g., EDT), or nothing if no time zone is determinable

Date fields:

a

locale’s abbreviated weekday name (Sun..Sat)

A

locale’s full weekday name, variable length (Sunday..Saturday)

b

locale’s abbreviated month name (Jan..Dec)

B

locale’s full month name, variable length (January..December)

c

locale’s date and time (Sat Nov 04 12:02:33 EST 1989)

d

day of month (01..31)

D

date (mm/dd/yy)

h

same as b

j

day of year (001..366)

m

month (01..12)

U

week number of year with Sunday as first day of week (00..53)

w

day of week (0..6)

W

week number of year with Monday as first day of week (00..53)

x

locale’s date representation (mm/dd/yy)

y

last two digits of year (00..99)

Y

year (1970...)

%u

User’s name, or numeric user ID if the user has no

name.

%U

User’s numeric user ID.

A ‘%’ character followed by any other character is discarded (but the other character is printed).

−ls

True; list current log entry in long format on standard output.

OPERATORS

Listed in order of decreasing precedence:

( expr )

Force precedence.

! expr

True if expr is false.

-not expr

Same as ! expr.

expr1 expr2

And (implied); expr2 is not evaluated if expr1 is false.

expr1 -a expr2

Same as expr1 expr2.

expr1 -and expr2

Same as expr1 expr2.

expr1 -o expr2

Or; expr2 is not evaluated if expr1 is true.

expr1 -or expr2

Same as expr1 −o expr2.

expr1 , expr2

List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the list is the value of expr2.

SORT KEYS

KEY DESCRIPTION

date

sort by login date

disp

sort by display name

display

alias for disp

host

sort by host name

user

sort by user name

none

do not sort

ENVIRONMENT VARIABLES

Here are the configuration means listed by decreasing precedence: command line option, environment variable, configuration file directive.

ULOGRC

Sets the configuration file location.

ULOG_SERVER

Sets the ulogd server hostname (and/or port number) via the syntax ‘[host][:port]’. If port number is omitted, default port is used (3209/tcp). If the ulogd server hostname is omitted, the default hostname is used, if configured before compilation.

ULOG_HOST

Alias for ULOG_SERVER.

ULOG_PORT

Sets the ulogd server port number. If no hostname needs to be specified, it is equivalent to set ULOG_HOST to ‘:port’.

ULOG_DEBUG

If set, enables the printing of debug messages.

SEE ALSO

ulog.conf(5), ulogd(8), find(1).

AUTHOR

Hervé Eychenne <rv@fr.alcove.com>