Documente Academic
Documente Profesional
Documente Cultură
$# -> 2
no of Argument
array of argument
$0 -> myapp
application name
$1 -> foo
first argument
$2 -> bar
WHO command
NAME
who - show who is logged on
SYNOPSIS
who [OPTION]... [ FILE | ARG1 ARG2 ]
DESCRIPTION
Print information about users who are currently logged in.
-a, --all
same as -b -d --login -p -r -t -T -u
-b, --boot
time of last system boot
-d, --dead
print dead processes
-H, --heading
print line of column headings
--ips print ips instead of hostnames. with --lookup, canonicalizes based on stored IP, if available,
rather than stored hostname
-l, --login
print system login processes
--lookup
attempt to canonicalize hostnames via DNS
-m
-p, --process
print active processes spawned by init
-q, --count
all login names and number of users logged on
-r, --runlevel
print current runlevel
-s, --short
-t, --time
print last system clock change
-u, --users
list users logged in
To find a user's UID or GID in Unix, use the id command. To find a specific user's UID, at
the Unix prompt, enter:
id -u username
oracle@ubuntu:/etc$ id -u oracle
1001
Replace username with the appropriate user's username. To find a user's GID, at the Unix
prompt, enter:
id -g username
eg:oracle@ubuntu:/etc$ id -g `whoami`
1001
If you wish to find out all the groups a user belongs to, instead enter:
id -G username
eg:oracle@ubuntu:/etc$ id -G `whoami`
1001 1002
If you wish to see the UID and all groups associated with a user, enter id without any
options, as follows:
id username
Finger
-s Finger displays the user's login name, real name, terminal name and write status
(as a ``*''
after the terminal name if write permission is denied), idle time, login time, office
location
and office phone number.
Login time is displayed as month, day, hours and minutes, unless more than six
months ago, in
which case the year is displayed rather than the hours and minutes.
Unknown devices as well as nonexistent idle and login times are displayed as single
asterisks.
-l Produces a multi-line format displaying all of the information described for the -s
option as
well as the user's home directory, home phone number, login shell, mail status, and
the contents
of the files .plan.project.pgpkey.forward
as five digits are printed as ``xN-NNNN''. Numbers specified as four digits are
printed as
``xNNNN''.
Mail status is shown as ``No Mail.'' if there is no mail at all, ``Mail last read DDD
MMM ##
HH:MM YYYY (TZ)'' if the person has looked at their mailbox since new mail arriving,
or ``New
mail received ...'', `` Unread since ...'' if they have new mail.
root@ubuntu:/home/tomhawk12/Scripts# finger -s
Login
Name
Tty
oracle
pts/0
oracle
pts/3
Office
Office Phone
tomhawk12 KUMAR
tty7
tomhawk12 KUMAR
pts/1
tomhawk12 KUMAR
pts/2
root@ubuntu:/home/tomhawk12/Scripts# finger -l
Login: oracle
Directory: /home/oracle
Name:
Shell: /bin/bash
Login: tomhawk12
Directory: /home/tomhawk12
Name: KUMAR
Shell: /bin/bash