Score:0

command w and who shows 0 users are logged in

cl flag

Currently I am using Ubuntu 20.04.3 LTS Problem which I am having now is that who and w commands who 0 users are logged in system.

mypc:~$ who
mypc:~$ w
 22:14:10 up 12 min,  0 users,  load average: 0.52, 0.58, 0.59
 USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

enter image description here

I am logged in the system, but why are these commands showing that 0 users are logged in currently?

hr flag
Is this a regular Ubuntu system - or Windows Subsystem for Linux?
game lover avatar
cl flag
@steeldriver WSL
terdon avatar
cn flag
@steeldriver looks like a dupe, is it not?
terdon avatar
cn flag
Ah, I see. I have no clue, @steeldriver, I haven't touched WSL. I voted to close, not realizing that it was tagged with `command-line`, meaning I could single-handedly close it. Game lover, if the dupe does not answer your question, please let me know and I'll vote to reopen.
game lover avatar
cl flag
@terdon I tried both alternatives from the link. The second one did not work absolutely so I tried the first one. First one ... works but I have to repeat same process everytime I log in to system..
terdon avatar
cn flag
@gamelover yes, the main answer seems to be that `who` doesn't really work on WSL.
game lover avatar
cl flag
@terdon is there any other alternative which I can use to see loged in users in WSL?
terdon avatar
cn flag
No idea, sorry. Maybe you could ask a new question focusing on that instead? But I suspect you might get better answers on [su] since folks here tend to know the Linux side of things and WSL is a strange hybrid. You could use `ps aux | tail -n +2 | awk '{print $1}' | sort -u` to see the list of users currently running processes, but that would include system users as well. You can exclude those with something like `ps aux | tail -n +2 | awk '{print $1}' | sort -u | grep -f <(grep -Ev 'nologin|/false' /etc/passwd | cut -d: -f1)` which you could make into a function or alias.
game lover avatar
cl flag
@terdon thanks for help, but I guess downloading a VirtualBox and run ubuntu there may be will be the easiest and best solution haha :( want to cry
terdon avatar
cn flag
Do try asking a new question. Explain what you actually need (it seems unlikely that you would often have multiple users logged into a WSL system) and what you are trying to achieve (_why_ do you want the output of `who`? What are you going to do with it) and someone might be able to come up with an answer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.