Reputation: 179
At the moment I am trying with the:
w --no-header
but it lists the same user twice:
myuser tty7
myuser pts/0
How to make it to give me back only once?
It should be simply
myuser
Thanks in advance
Upvotes: 0
Views: 93
Reputation: 72629
If you filter for just the first column, then sort/uniq, you would use
w --no-header | awk '{print $1}' | sort -u
Put it in a shell function and there you go.
Upvotes: 1