Sunday, April 28, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 2444  / 2 Years ago, thu, may 19, 2022, 11:46:23

The title says it all. I'm the only user on my computer, but when I type in who | wc -l, it responds with 2. Why is that?


More From » command-line

 Answers
5

This is because an open terminal (physical or virtual) is counted as a user logged in. So when you log-in to the account, you log-in once, when you open your terminal, either using Ctrl+Alt+t(hereon called as a virtual terminal) or using Ctrl+Alt+F{1-7}(hereon called as a physical terminal), you log-in once again, each time you log-in.



This is clearly shown in the output of who. The second column shows how the user has logged in. In case you have logged in using the virtual terminal, you will see pts/<no> which represents you have used /dev/pts to log in, which is used to log in using the virtual terminal. If you log-in using the physical terminal, you will see tty<no>, which represents you have used /dev/tty to log-in.



To clarify this, see the following situation:



I have logged in once using the graphical interface, once using the virtual terminal, once using the physical terminal, so the output is:



jobin    tty1         2014-03-31 18:05
jobin :0 2014-03-31 16:58 (:0)
jobin pts/1 2014-03-31 17:25 (:0)


The first line indicates the physical terminal login, the second one the graphical and the third one the virtual one.



So the reason you see "2" is because you have logged in to the graphical interface as well as a terminal(not pretty sure whether you have a physical or virtual one).


[#26270] Saturday, May 21, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
coffekne

Total Points: 114
Total Questions: 122
Total Answers: 126

Location: Mauritania
Member since Sun, Oct 17, 2021
3 Years ago
;