If you simply want to see who is on the system use the
who command.
Just type
who and press enter. This produces a list of users currently on the system, their terminal or port number, date logged in, time logged in and if attached to a display the display number.
If you simply want the user names and nothing else use the following code:
Code:
who | awk -F " " '{print $1}'
To make a script, use the following:
Code:
#!/bin/sh
# filename: whoisloggedon
who | awk -F " " '{print $1}'
Don't forget to make the script executable
chmod 766 whoisloggedon