With help of the who command we can get active users,
I want only the first field
such as
user 1
user 2
user 3
You can get just the user names like so:
who | awk '{print $1}' | sort
Where who lists all logged in users, passes the output to awk which only prints the first section ("column") of text for every line, passes it to sort which sorts the output.
sort -uinstead ofsort | uniq– DK Bose Feb 26 '14 at 11:00who | cut --delimiter=' ' --field=1 | sort --unique(the short version reads:who|cut -d' ' -f1|sort -u). – Paddy Landau Mar 04 '14 at 22:49