If you’re wondering how to find out who is currently logged into a Microsoft Windows computer, there are several ways to proceed. Here are a few common methods you can use from a remote computer or logged into the local computer you are querying.
WhoAmI Command
The “whoami” command displays the user you are currently logged in and using in Windows.
- Hold down the Windows Key, and press “R” to bring up the Run window.
- Type “CMD“, then press “Enter” to open a command prompt.
- At the command prompt, type the following then press “Enter“:
whoami
- The computer name or domain followed by the username is displayed.
Query User Command
This command allows you to see all users currently logged into the computer.
Locally
- Hold down the Windows Key, and press “R” to bring up the Run window.
- Type “CMD“, then press “Enter” to open a command prompt.
- At the command prompt, type the following then press “Enter“:
query user
- The computer name or domain followed by the username is displayed.
Remotely
- Hold down the Windows Key, and press “R” to bring up the Run window.
- Type “CMD“, then press “Enter” to open a command prompt.
- At the command prompt, type the following then press “Enter“:
query user /server:computername
Replace “computername” with the actual computer name of the system you are querying. You can also use the IP Address of the computer. - The computer name or domain followed by the username is displayed.
Task Manager
- Right-click the taskbar, then select “Task Manager“.
- Select the “Users” tab.
- Details on the users logged into the machine are displayed.
WMIC
- Hold down the Windows Key, and press “R” to bring up the Run window.
- Type “CMD“, then press “Enter” to open a command prompt.
- At the command prompt, type the following then press “Enter“:
WMIC /NODE:"computername" COMPUTERSYSTEM GET USERNAME
Replace “computername” with the actual computer name of the system you are querying. You can also replace “computername” with the IP address of the system.WMIC /NODE:192.168.1.1 COMPUTERSYSTEM GET USERNAME
How to check how many users are logged in to the Linux system? There are few commands we can use to show currently logged in users in Linux Operating System.
The users command will print the usernames of the current logged in users.
users
One user could be listed more than once, if the user has logged in from more than one location. We can filter the output with the uniq command to get a unique entry for each user.
users | tr ' ' '\n' | uniq
Get the user count with wc command:
users | tr ' ' '\n' | wc -l
Get the unique user count:
users | tr ' ' '\n' | uniq | wc -l
who command
The who command provides detailed information about currently logged in users.
who
root tty1 2017-07-17 19:21
user pts/0 2017-07-17 19:23 [192.168.1.105]
root pts/1 2017-07-17 19:24 [192.168.1.105]
The who command will show the username, tty [terminal used by the user] and logged in Time. Again, if a user have opened multiple terminals, the user will be listed multiple times.
The --count option will print all usernames and user count.
who --count root user root # users=3
The w Command
The w command provides even more detailed information about Linux logged in users.
w
Show a Listing of Last Logged in users
The last command shows the most recent successful logins to the Linux system.
last
Number of result can be defined with -n option. Following example will show five most recent successful logins.
last -n 5
As shown in the above screenshot three users are still logged in to the system.
Step 2- Type query user and press Enter. It will list all users that are currently logged on your computer.
Using Task manager -
Step 1 -Right-click on the taskbar and select Task Manager to launch Task Manager. If you’re using Windows 10/8, you might need to click the More details button located at the bottom to see active processes.
Step 2 - Click the Users tab at the top of Task Manager, you can see the list of currently logged in users and their status.