User Information
User Information
who It is used to get information about currently logged in user on to system. If you don't provide any option or arguments, the command displays the following information for each logged-in user.
- Login name of the user
- User terminal
- Date & Time of login
- Remote host name of the user
$ who sudheer :0 2019-08-04 01:21 (:0)
whoami: It display the system’s username
$ whoami sudheer
id: It display the user identification(the real and effective user and group IDs) information
$ id uid=1000(sj) gid=1000(sj) groups=1000(sj),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare)
groups: This command is used to display all the groups for which the user belongs to.
$ group sj: sj, adm, cdrom, sudo, dip, plugdev, lpadmin, lxd, sambashare
finger: Used to check the information of any currently logged in users. i.e, It displays users login time, tty (name), idle time, home directory, shell name etc.
$ finger Login Name Tty Idle Login Time Office Office Phone sj sj *:0 Aug 28 01:27 (:0)
This may not be available by default in many linux machines. In this case, you need to install it manually.
$ sudo apt install finger
users: Displays usernames of all users currently logged on the system.
$ users sj
grep: It is a powerful pattern searching tool to find information about a specific user from the system accounts file: /etc/passwd.
$ grep -i sj /etc/passwd sj:x:1000:1000:sj,,,:/home/sj:/bin/bash
W Command: It(W) is a command-line utility that displays information about currently logged in users and what each user is doing.
w [OPTIONS] [USER] Example: w 18:45:04 up 2:09, 1 user, load average: 0.09, 0.07, 0.02 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT sj :0 :0 01:27 ?xdm? 1:14 0.01s /usr/lib/gdm3/g
last or lastb: Displays a list of last logged in users on the system. You can pass user names to display their login and hostname details.
last [options] [username...] [tty...] Example: last sj :0 :0 Fri Aug 28 01:27 gone - no logout reboot system boot 5.4.0-29-generic Fri Aug 28 01:27 still running sj :0 :0 Wed Jul 29 11:46 - crash (29+13:40) reboot system boot 5.4.0-29-generic Wed Jul 29 11:45 still running sj :0 :0 Thu May 14 21:04 - crash (75+14:41) reboot system boot 5.4.0-29-generic Thu May 14 21:03 still running wtmp begins Thu May 14 21:03:56 2020
lastlog: The
lastlog
command is used to find the details of a recent login of all users or of a given user.$ lastlog Username Port From Latest root **Never logged in** daemon **Never logged in** bin **Never logged in** sys **Never logged in** sync **Never logged in** games **Never logged in** man **Never logged in** lp **Never logged in** mail **Never logged in** news **Never logged in**
Comments
Post a Comment