There are a couple of ways to find out users information in Linux. One of the most basic methods is to use the “who” command. This will tell you who is currently logged in to your Linux dedicated server.
First, log into your system’s shell via SSH. Next, login in as root:
The final step is to simply type “who” and press enter. You will see a list of users, as well as the date and time they first logged in.
user1 pts/0 Apr 30 16:40 (hostname.server.domain)
In addition, type “who -b” to find out the last time the system was booted and “who -q” to list the names of users followed by a total count of the number of users on the system. If for some reason, you need to list your own user name, type:
Now that you know which users are currently logged in, you might also want to know the offline ones as well. To list all users, the command is a little more complicated, but it will give you the results you need. From the command prompt, type:
cat /etc/passwd | cut -d":" -f1
That will print out a simple list of all users, including those that run via software automation, such as the user “nobody”.
To find out the total number of accounts, enter the following:
cat /etc/passwd | wc -l
The output will be a single number counting all users. Please keep in mind that this will count users created by both Linux and the system administrator.