How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

10 ‘who’ Command Examples for Linux Newbies

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
20
VIEWS
Share on FacebookShare on Twitter

In our earlier article, we have explained 11 ways to find user account info and login details in Linux. One of the various commands we mentioned was the who command which displays users who are currently logged on to a Linux system, including the terminals they are connecting from.

This article will explain some useful examples of who command for Linux newbies.

The basic syntax for using who command is as follows.

$ who who [OPTION]... [ FILE | ARG1 ARG2 ]

1. If you run who command without any arguments, it will display account information (user login name, user’s terminal, time of login as well as the host the user is logged in from) on your system similar to the one shown in the following output.

$ who

ravi		tty1	        2018-03-16	19:27
tecmint	        pts/0		2018-03-16	19:26	(192.168.56.1)
root		pts/1		2018-03-16	19:27	(192.168.56.1)

2. To print the heading of the columns displayed, use the -H flag as shown.

$ who -H

NAME            LINE                   TIME             COMMENT
ravi		tty1	        2018-03-16   19:27
tecmint	        pts/0		2018-03-16   19:26	(192.168.56.1)
root		pts/1		2018-03-16   19:27	(192.168.56.1) 

3. To print the login names and total number of logged on users, use the -q flag.

$ who -q

ravi   tecmint    root
# users=3

4. In case you want to show only hostname and user associated with stdin, use the -m switch.

$ who -m

tecmint	        pts/0		2018-03-16	19:26	(192.168.56.1)

5. Next, to add user’s message status as +, - or ?, use the -T option.

$ who -T

ravi	      +  tty1	        2018-03-16	19:27
tecmint	      +  pts/0		2018-03-16	19:26	(192.168.56.1)
root	      +  pts/1		2018-03-16	19:27	(192.168.56.1)

The who command also helps you to view some useful system information such as last boot time, current runlevel (target under systemd), print dead processes as well as processes spawned by init.

6. To view the time of last system boot, use the -b flag and adding the -u option allows for listing of logged on users in the same output.

$ who -b

system boot  2018-01-19 02:39
$ who -bu

                system boot  2018-03-16 19:25
ravi		tty1		2018-03-16		19:27  00:33		2366
tecmint	        pts/0	        2018-03-16	        19:26	 .              2332     (192.168.56.1)
root		pts/1		2018-03-16		19:27	00:32           2423     (192.168.56.1)

7. You can check the current runlevel with the -r option.

$ who -r

run-level 3  2018-03-16 02:39

8. The following command will print dead processes.

$ who -d

pts/1        2018-03-16 11:10              9986 id=ts/1  term=0 exit=0

9. Furthermore, to see active processes spawned by init, use the -p option.

$ who -p

10. Last but not least, the -a flag allows for printing of default output combined with information from some of the options we have covered.

$ who -a
 
system boot  2018-06-16 02:39
           run-level 3  2018-01-19 02:39
LOGIN      tty1         2018-01-19 02:39              3258 id=1
LOGIN      ttyS0        2018-01-19 02:39              3259 id=S0
tecmnt   + pts/0        2018-03-16 05:33   .          20678 (208.snat-111-91-115.hns.net.in)
           pts/1        2018-03-14 11:10              9986 id=ts/1  term=0 exit=0

You can find more options by consulting the who man page.

$ man who 

In this article, we have explained 10 who command examples for Linux newbies. Use the comment section below to ask any questions or give us your feedback.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install Apache Tomcat 8 on CentOS 7
Linux

How to Install Apache Tomcat 8 on CentOS 7?

February 11, 2020
Install Arch Linux With Btrfs Snapshotting
Uncategorized

Install Arch Linux With Btrfs Snapshotting

February 13, 2020
Next Post

5 Command Line Tools to Find Files Quickly in Linux

How to Disable Shutdown and Reboot Commands in Linux

Wikit – A Command Line Tool to Search Wikipedia in Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

Setup and Configure Murmur (Mumble Server) On FreeBSD 11

4 years ago

How to Install TextPattern CMS 4.6.2 on a Debian 9 LAMP VPS

3 years ago

Reset MySQL Root Password on Debian/Ubuntu

3 years ago

10 Useful Linux Command Line Tricks for Newbies – Part 2

4 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.