> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Show Logged in Users on Linux
- URL: https://itsfoss.com/logged-in-users-linux/
- Published: 2023-04-19T07:01:43.000Z
- Updated: 2023-10-03T12:33:30.000Z
- Description: Got a multiuser Linux system and wondering who is logged in it? Here are various ways to find that out.
- Author: Sagar Sharma
- Tags: Quick Tip

If you are running a server or a system that is being used by multiple users, you may want to [find the users](https://itsfoss.com/linux-list-users/) who are logged in currently.

And the easiest way to do that is by executing the `users` command:

```
users
```

![find the logged in users in Ubuntu](https://itsfoss.com/content/images/2023/04/find-the-logged-in-users-in-Ubuntu.png)

And as you can see, it gets the list of the currently logged-in users. 

But there are other ways that give more detailed output than just listing the logged-in users. 

Want to know what they are? Here you have it.

## How to find logged-in users in Linux

There are multiple ways to find the logged-in users in Linux and I will be sharing the ones that provide more detailed output like IP address, time of logging in, etc.

So let's start with the first one.

### Using the w command 

This command gives you information like log-in time, IP, the terminal used to log in, and much more.

And execution is also quite simple. All you have to do is execute a single-character command:

```
w
```

![use w command to know the logged in users in Linux](https://itsfoss.com/content/images/2023/04/use-w-command-to-know-the-logged-in-users-in-Linux.png)

Here,

- `USER` indicates the username of the logged-in user.
- `TTY` indicates which terminal was used to log in. Here, `tty7` indicates that the user has **used the native terminal** to log in and `pts` indicates the user has **logged in via SSH**.
- `FROM` is where you'll find the IP of the remotely logged-in used.
- `LOGIN@` indicates the time of logging in.
- `IDLE` shows the time the user is in an idle state (doing nothing).
- `JCPU` is a time used by all the processes attached to the current tty.
- `PCPU` is a time taken by the current process and mentioned in the `WHAT` field.
- `WHAT` indicates the current process.

Pretty detailed. Isn't it?

💡

You may use the last command to see the recent logins to the system. It will show both current and recently logged in details.

### Using the who command

This is yet another way to list logged-in users and can be suitable for those who want to have less detailed output compared to what the `w` command gave.

The command execution is quite simple:

```
who -H
```

![use who command to know the logged in users](https://itsfoss.com/content/images/2023/04/use-who-command-to-know-the-logged-in-users.png)

The `-H` option prints the heading which makes it easier to understand the output. The heading elements are:

- `NAME` show the username of the logged-in user
- `LINE` indicates which terminal was used to log in
- `TIME` column shows the time of logging in
- `COMMENT` is where you'll find the IP of remote logins

I know the column names are pretty different and do not make much sense but that's what the [who command](https://linuxhandbook.com/who-command/?ref=itsfoss.com) offers!

![](https://itsfoss.com/content/images/2023/04/efficient-at-linux-command-line-horizontal.png) 

#### New Book: Efficient Linux at the Command Line

Pretty amazing Linux book with lots of practical tips. It fills in the gap, even for experienced Linux users. Must have in your collection.

[Get it from Amazon](https://amzn.to/3MPjiHw?ref=itsfoss.com) 

### Using the finger utility

If you want the most detailed output, the finger utility will do the job as it is a user information utility so if you added extra details while [adding users in Linux](https://linuxhandbook.com/useradd-command/?ref=itsfoss.com), they will be reflected here!

But it does not come pre-installed and you'd have so here's how you install it.

For Ubuntu/Debian base:

```
sudo apt install finger
```

For Arch Linux:

```
yay -S netkit-bsd-finger
```

For Fedora/RHEL:

```
sudo dnf install finger
```

Once you are done with the installation, all you have to do is execute the following command:

```
finger 
```

![use finger command to find the logged in users](https://itsfoss.com/content/images/2023/04/use-finger-command-to-find-the-logged-in-users.png)

And as you can see, there are two extra rows for Office and Phone, so if you added extra details while creating a user, it should be reflected here!

## Want to log out inactive users? 

Once you know which users are inactive, you may want to log them out. So how do you do that? Here's a detailed guide:

[How to Automatically Logout Inactive Linux UsersHere are two ways you can automatically log out idle users from your Linux system.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookAbhishek Prakash![](https://linuxhandbook.com/content/images/2020/10/auto-logout-linux-users.png)](https://linuxhandbook.com/auto-logout-linux/?ref=itsfoss.com)

I hope you will find this informative. And if you have any queries, feel free to ask in the comments.