0

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?

game lover
  • 125
  • 5
  • Is this a regular Ubuntu system - or Windows Subsystem for Linux? – steeldriver Feb 28 '22 at 21:18
  • @steeldriver WSL – game lover Feb 28 '22 at 21:19
  • @steeldriver looks like a dupe, is it not? – terdon Feb 28 '22 at 21:41
  • 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. – terdon Feb 28 '22 at 21:51
  • @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.. – game lover Feb 28 '22 at 22:02
  • @gamelover yes, the main answer seems to be that `who` doesn't really work on WSL. – terdon Feb 28 '22 at 22:08
  • @terdon is there any other alternative which I can use to see loged in users in WSL? – game lover Feb 28 '22 at 22:09
  • 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. – terdon Feb 28 '22 at 22:13
  • @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 – game lover Feb 28 '22 at 22:23
  • 1
    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. – terdon Feb 28 '22 at 22:26

0 Answers0