How do I get the list of the active login sessions?












6















Nov 9 17:55:46 swi007 systemd-logind[927]: New session 27 of user
swi007.




I want to see the list of active login session in ubuntu server and would like to close the specific session in my server.










share|improve this question





























    6















    Nov 9 17:55:46 swi007 systemd-logind[927]: New session 27 of user
    swi007.




    I want to see the list of active login session in ubuntu server and would like to close the specific session in my server.










    share|improve this question



























      6












      6








      6


      3






      Nov 9 17:55:46 swi007 systemd-logind[927]: New session 27 of user
      swi007.




      I want to see the list of active login session in ubuntu server and would like to close the specific session in my server.










      share|improve this question
















      Nov 9 17:55:46 swi007 systemd-logind[927]: New session 27 of user
      swi007.




      I want to see the list of active login session in ubuntu server and would like to close the specific session in my server.







      command-line server login session






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 6:50









      pa4080

      13.5k52562




      13.5k52562










      asked Nov 9 '17 at 14:11









      zapoxkrishnazapoxkrishna

      3317




      3317






















          1 Answer
          1






          active

          oldest

          votes


















          9














          Here are few alternatives to get the list of the current session:





          • The command who - display who is on the system:





            $ who
            spas pts/1 2017-11-05 21:43 (tmux(1597).%0)
            spas pts/14 2017-11-09 13:02 (192.168.100.110)
            guest tty2 2017-11-09 16:15 (:1)



          • The command w - displays information about the users currently on the machine:



            $ w
            16:16:12 up 3 days, 18:33, 9 users, load average: 4,33, 2,79, 2,44
            USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
            spas pts/1 tmux(1597).%0 нд21 3days 3days 3days tmux new-session -d -s my-tmux-session
            spas pts/14 192.168.100.110 13:02 1.00s 0.29s 0.01s sshd: spas [priv]
            guest tty2 :1 16:15 3days 1.27s 0.17s /sbin/upstart --user


          • The command last lastb - show a (history) listing of last logged in users. It provides few analytical options as --until, --since, etc.



          • The command users - print the usernames of users currently logged-in to the current host. It has really limited usage:



            $ users
            guest spas spas





          To kill a specific session you could use who -u (or who -a) to print the process numbers and then sudo kill -9 <session-process-number>:



          $ who -u
          spas pts/1 2017-11-05 21:43 old 1597 (tmux(1597).%0)
          spas pts/14 2017-11-09 13:02 . 31822 (192.168.100.110)
          guest tty2 2017-11-09 16:15 old 2225 (:1)

          $ sudo kill -9 2225 # this command will kill the third session from the above list




          Additionally you could kill all processes of a specific user (reference):



          sudo pkill -9 -u <username>




          See also:




          • How do I find who is logged-in as root?


          • How do I list logged-in users without duplicates?







          share|improve this answer























          • how to kill specific session
            – zapoxkrishna
            Nov 9 '17 at 14:20










          • @zapoxkrishna, check the update.
            – pa4080
            Nov 9 '17 at 14:29










          • you missed the last command which as well list all active sessions :)
            – Videonauth
            Nov 9 '17 at 14:48










          • Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
            – pa4080
            Nov 9 '17 at 14:58











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f974718%2fhow-do-i-get-the-list-of-the-active-login-sessions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          9














          Here are few alternatives to get the list of the current session:





          • The command who - display who is on the system:





            $ who
            spas pts/1 2017-11-05 21:43 (tmux(1597).%0)
            spas pts/14 2017-11-09 13:02 (192.168.100.110)
            guest tty2 2017-11-09 16:15 (:1)



          • The command w - displays information about the users currently on the machine:



            $ w
            16:16:12 up 3 days, 18:33, 9 users, load average: 4,33, 2,79, 2,44
            USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
            spas pts/1 tmux(1597).%0 нд21 3days 3days 3days tmux new-session -d -s my-tmux-session
            spas pts/14 192.168.100.110 13:02 1.00s 0.29s 0.01s sshd: spas [priv]
            guest tty2 :1 16:15 3days 1.27s 0.17s /sbin/upstart --user


          • The command last lastb - show a (history) listing of last logged in users. It provides few analytical options as --until, --since, etc.



          • The command users - print the usernames of users currently logged-in to the current host. It has really limited usage:



            $ users
            guest spas spas





          To kill a specific session you could use who -u (or who -a) to print the process numbers and then sudo kill -9 <session-process-number>:



          $ who -u
          spas pts/1 2017-11-05 21:43 old 1597 (tmux(1597).%0)
          spas pts/14 2017-11-09 13:02 . 31822 (192.168.100.110)
          guest tty2 2017-11-09 16:15 old 2225 (:1)

          $ sudo kill -9 2225 # this command will kill the third session from the above list




          Additionally you could kill all processes of a specific user (reference):



          sudo pkill -9 -u <username>




          See also:




          • How do I find who is logged-in as root?


          • How do I list logged-in users without duplicates?







          share|improve this answer























          • how to kill specific session
            – zapoxkrishna
            Nov 9 '17 at 14:20










          • @zapoxkrishna, check the update.
            – pa4080
            Nov 9 '17 at 14:29










          • you missed the last command which as well list all active sessions :)
            – Videonauth
            Nov 9 '17 at 14:48










          • Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
            – pa4080
            Nov 9 '17 at 14:58
















          9














          Here are few alternatives to get the list of the current session:





          • The command who - display who is on the system:





            $ who
            spas pts/1 2017-11-05 21:43 (tmux(1597).%0)
            spas pts/14 2017-11-09 13:02 (192.168.100.110)
            guest tty2 2017-11-09 16:15 (:1)



          • The command w - displays information about the users currently on the machine:



            $ w
            16:16:12 up 3 days, 18:33, 9 users, load average: 4,33, 2,79, 2,44
            USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
            spas pts/1 tmux(1597).%0 нд21 3days 3days 3days tmux new-session -d -s my-tmux-session
            spas pts/14 192.168.100.110 13:02 1.00s 0.29s 0.01s sshd: spas [priv]
            guest tty2 :1 16:15 3days 1.27s 0.17s /sbin/upstart --user


          • The command last lastb - show a (history) listing of last logged in users. It provides few analytical options as --until, --since, etc.



          • The command users - print the usernames of users currently logged-in to the current host. It has really limited usage:



            $ users
            guest spas spas





          To kill a specific session you could use who -u (or who -a) to print the process numbers and then sudo kill -9 <session-process-number>:



          $ who -u
          spas pts/1 2017-11-05 21:43 old 1597 (tmux(1597).%0)
          spas pts/14 2017-11-09 13:02 . 31822 (192.168.100.110)
          guest tty2 2017-11-09 16:15 old 2225 (:1)

          $ sudo kill -9 2225 # this command will kill the third session from the above list




          Additionally you could kill all processes of a specific user (reference):



          sudo pkill -9 -u <username>




          See also:




          • How do I find who is logged-in as root?


          • How do I list logged-in users without duplicates?







          share|improve this answer























          • how to kill specific session
            – zapoxkrishna
            Nov 9 '17 at 14:20










          • @zapoxkrishna, check the update.
            – pa4080
            Nov 9 '17 at 14:29










          • you missed the last command which as well list all active sessions :)
            – Videonauth
            Nov 9 '17 at 14:48










          • Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
            – pa4080
            Nov 9 '17 at 14:58














          9












          9








          9






          Here are few alternatives to get the list of the current session:





          • The command who - display who is on the system:





            $ who
            spas pts/1 2017-11-05 21:43 (tmux(1597).%0)
            spas pts/14 2017-11-09 13:02 (192.168.100.110)
            guest tty2 2017-11-09 16:15 (:1)



          • The command w - displays information about the users currently on the machine:



            $ w
            16:16:12 up 3 days, 18:33, 9 users, load average: 4,33, 2,79, 2,44
            USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
            spas pts/1 tmux(1597).%0 нд21 3days 3days 3days tmux new-session -d -s my-tmux-session
            spas pts/14 192.168.100.110 13:02 1.00s 0.29s 0.01s sshd: spas [priv]
            guest tty2 :1 16:15 3days 1.27s 0.17s /sbin/upstart --user


          • The command last lastb - show a (history) listing of last logged in users. It provides few analytical options as --until, --since, etc.



          • The command users - print the usernames of users currently logged-in to the current host. It has really limited usage:



            $ users
            guest spas spas





          To kill a specific session you could use who -u (or who -a) to print the process numbers and then sudo kill -9 <session-process-number>:



          $ who -u
          spas pts/1 2017-11-05 21:43 old 1597 (tmux(1597).%0)
          spas pts/14 2017-11-09 13:02 . 31822 (192.168.100.110)
          guest tty2 2017-11-09 16:15 old 2225 (:1)

          $ sudo kill -9 2225 # this command will kill the third session from the above list




          Additionally you could kill all processes of a specific user (reference):



          sudo pkill -9 -u <username>




          See also:




          • How do I find who is logged-in as root?


          • How do I list logged-in users without duplicates?







          share|improve this answer














          Here are few alternatives to get the list of the current session:





          • The command who - display who is on the system:





            $ who
            spas pts/1 2017-11-05 21:43 (tmux(1597).%0)
            spas pts/14 2017-11-09 13:02 (192.168.100.110)
            guest tty2 2017-11-09 16:15 (:1)



          • The command w - displays information about the users currently on the machine:



            $ w
            16:16:12 up 3 days, 18:33, 9 users, load average: 4,33, 2,79, 2,44
            USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
            spas pts/1 tmux(1597).%0 нд21 3days 3days 3days tmux new-session -d -s my-tmux-session
            spas pts/14 192.168.100.110 13:02 1.00s 0.29s 0.01s sshd: spas [priv]
            guest tty2 :1 16:15 3days 1.27s 0.17s /sbin/upstart --user


          • The command last lastb - show a (history) listing of last logged in users. It provides few analytical options as --until, --since, etc.



          • The command users - print the usernames of users currently logged-in to the current host. It has really limited usage:



            $ users
            guest spas spas





          To kill a specific session you could use who -u (or who -a) to print the process numbers and then sudo kill -9 <session-process-number>:



          $ who -u
          spas pts/1 2017-11-05 21:43 old 1597 (tmux(1597).%0)
          spas pts/14 2017-11-09 13:02 . 31822 (192.168.100.110)
          guest tty2 2017-11-09 16:15 old 2225 (:1)

          $ sudo kill -9 2225 # this command will kill the third session from the above list




          Additionally you could kill all processes of a specific user (reference):



          sudo pkill -9 -u <username>




          See also:




          • How do I find who is logged-in as root?


          • How do I list logged-in users without duplicates?








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 10 '18 at 9:57

























          answered Nov 9 '17 at 14:18









          pa4080pa4080

          13.5k52562




          13.5k52562












          • how to kill specific session
            – zapoxkrishna
            Nov 9 '17 at 14:20










          • @zapoxkrishna, check the update.
            – pa4080
            Nov 9 '17 at 14:29










          • you missed the last command which as well list all active sessions :)
            – Videonauth
            Nov 9 '17 at 14:48










          • Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
            – pa4080
            Nov 9 '17 at 14:58


















          • how to kill specific session
            – zapoxkrishna
            Nov 9 '17 at 14:20










          • @zapoxkrishna, check the update.
            – pa4080
            Nov 9 '17 at 14:29










          • you missed the last command which as well list all active sessions :)
            – Videonauth
            Nov 9 '17 at 14:48










          • Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
            – pa4080
            Nov 9 '17 at 14:58
















          how to kill specific session
          – zapoxkrishna
          Nov 9 '17 at 14:20




          how to kill specific session
          – zapoxkrishna
          Nov 9 '17 at 14:20












          @zapoxkrishna, check the update.
          – pa4080
          Nov 9 '17 at 14:29




          @zapoxkrishna, check the update.
          – pa4080
          Nov 9 '17 at 14:29












          you missed the last command which as well list all active sessions :)
          – Videonauth
          Nov 9 '17 at 14:48




          you missed the last command which as well list all active sessions :)
          – Videonauth
          Nov 9 '17 at 14:48












          Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
          – pa4080
          Nov 9 '17 at 14:58




          Thank you, @Videonauth! Indeed I've never used this command. I've updated the answer.
          – pa4080
          Nov 9 '17 at 14:58


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f974718%2fhow-do-i-get-the-list-of-the-active-login-sessions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局