Display all the working terminals












1















I opened 4 terminals but when check them with who or w



me@alpha:~$ w
17:28:19 up 3:09, 1 user, load average: 0.51, 0.35, 0.34
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
me :0 :0 14:20 ?xdm? 3:27 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESS
me@alpha:~$ who
me :0 2019-01-16 14:20 (:0)


It display only one termianl called ':0'



if on macos it will display



me at mbp in ~
$ who
me console 2019-01-04 08:57
me ttys000 2019-01-04 08:57
me ttys001 2019-01-04 08:57


How could display all the terminal ?










share|improve this question

























  • amazing, yes @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 10:50











  • Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

    – Sergiy Kolodyazhnyy
    Jan 16 at 10:52











  • 谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 11:31






  • 1





    学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

    – Sergiy Kolodyazhnyy
    Jan 16 at 11:45
















1















I opened 4 terminals but when check them with who or w



me@alpha:~$ w
17:28:19 up 3:09, 1 user, load average: 0.51, 0.35, 0.34
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
me :0 :0 14:20 ?xdm? 3:27 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESS
me@alpha:~$ who
me :0 2019-01-16 14:20 (:0)


It display only one termianl called ':0'



if on macos it will display



me at mbp in ~
$ who
me console 2019-01-04 08:57
me ttys000 2019-01-04 08:57
me ttys001 2019-01-04 08:57


How could display all the terminal ?










share|improve this question

























  • amazing, yes @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 10:50











  • Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

    – Sergiy Kolodyazhnyy
    Jan 16 at 10:52











  • 谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 11:31






  • 1





    学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

    – Sergiy Kolodyazhnyy
    Jan 16 at 11:45














1












1








1








I opened 4 terminals but when check them with who or w



me@alpha:~$ w
17:28:19 up 3:09, 1 user, load average: 0.51, 0.35, 0.34
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
me :0 :0 14:20 ?xdm? 3:27 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESS
me@alpha:~$ who
me :0 2019-01-16 14:20 (:0)


It display only one termianl called ':0'



if on macos it will display



me at mbp in ~
$ who
me console 2019-01-04 08:57
me ttys000 2019-01-04 08:57
me ttys001 2019-01-04 08:57


How could display all the terminal ?










share|improve this question
















I opened 4 terminals but when check them with who or w



me@alpha:~$ w
17:28:19 up 3:09, 1 user, load average: 0.51, 0.35, 0.34
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
me :0 :0 14:20 ?xdm? 3:27 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESS
me@alpha:~$ who
me :0 2019-01-16 14:20 (:0)


It display only one termianl called ':0'



if on macos it will display



me at mbp in ~
$ who
me console 2019-01-04 08:57
me ttys000 2019-01-04 08:57
me ttys001 2019-01-04 08:57


How could display all the terminal ?







command-line tty who






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 16 at 11:12









Sergiy Kolodyazhnyy

73.1k9153317




73.1k9153317










asked Jan 16 at 9:32









AliceAlice

417110




417110













  • amazing, yes @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 10:50











  • Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

    – Sergiy Kolodyazhnyy
    Jan 16 at 10:52











  • 谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 11:31






  • 1





    学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

    – Sergiy Kolodyazhnyy
    Jan 16 at 11:45



















  • amazing, yes @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 10:50











  • Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

    – Sergiy Kolodyazhnyy
    Jan 16 at 10:52











  • 谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

    – Alice
    Jan 16 at 11:31






  • 1





    学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

    – Sergiy Kolodyazhnyy
    Jan 16 at 11:45

















amazing, yes @SergiyKolodyazhnyy

– Alice
Jan 16 at 10:50





amazing, yes @SergiyKolodyazhnyy

– Alice
Jan 16 at 10:50













Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

– Sergiy Kolodyazhnyy
Jan 16 at 10:52





Well, very nice ! Welcome to Ask Ubuntu ! 欢迎

– Sergiy Kolodyazhnyy
Jan 16 at 10:52













谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

– Alice
Jan 16 at 11:31





谢谢, 来学习了。 论语说“學而時習之”。 學 效也, 效倣, 模倣, imitate . 習, 練習(白羽), 幼鳥 煽動 剛剛髮育的白色的羽毛。 @SergiyKolodyazhnyy

– Alice
Jan 16 at 11:31




1




1





学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

– Sergiy Kolodyazhnyy
Jan 16 at 11:45





学习是君子之乐 :) 我没读过《论语》,只是偶尔看《周易》的卦解释,但是希望以后能学到了更多古文。这样以后看《三生三世十里桃花》会看懂更多的:) 那你也以后多模倣啊,要提升Linux水平为了写在这里的答案吧,哈哈。

– Sergiy Kolodyazhnyy
Jan 16 at 11:45










1 Answer
1






active

oldest

votes


















2














The issue is due to how certain terminals work. In particular, sakura and gnome-terminal (Ubuntu's default) which I have used before do not register the terminal. There is, in fact, a bug report for gnome-terminal, which is closed with WONTFIX status.



Finding number of open terminal sessions, therefore, should be focused on finding parent processes of shell sessions or associated pts/tty devices, as shown in this question:



$ ps -eo tty= | sort -u 


The only issue with this command is that it should display processes from all users. My personal approach would be to filter out my own processes ( i.e. terminals I opened myself ) via -u option and parse with awk:



#  Note that this includes tabs as well, not just open windows
$ ps -u $USER -o tty | awk 'NR>1 && $1 != "?" {a[$0]++};END{for(val in a) print val}'





share|improve this answer

























    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%2f1110203%2fdisplay-all-the-working-terminals%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









    2














    The issue is due to how certain terminals work. In particular, sakura and gnome-terminal (Ubuntu's default) which I have used before do not register the terminal. There is, in fact, a bug report for gnome-terminal, which is closed with WONTFIX status.



    Finding number of open terminal sessions, therefore, should be focused on finding parent processes of shell sessions or associated pts/tty devices, as shown in this question:



    $ ps -eo tty= | sort -u 


    The only issue with this command is that it should display processes from all users. My personal approach would be to filter out my own processes ( i.e. terminals I opened myself ) via -u option and parse with awk:



    #  Note that this includes tabs as well, not just open windows
    $ ps -u $USER -o tty | awk 'NR>1 && $1 != "?" {a[$0]++};END{for(val in a) print val}'





    share|improve this answer






























      2














      The issue is due to how certain terminals work. In particular, sakura and gnome-terminal (Ubuntu's default) which I have used before do not register the terminal. There is, in fact, a bug report for gnome-terminal, which is closed with WONTFIX status.



      Finding number of open terminal sessions, therefore, should be focused on finding parent processes of shell sessions or associated pts/tty devices, as shown in this question:



      $ ps -eo tty= | sort -u 


      The only issue with this command is that it should display processes from all users. My personal approach would be to filter out my own processes ( i.e. terminals I opened myself ) via -u option and parse with awk:



      #  Note that this includes tabs as well, not just open windows
      $ ps -u $USER -o tty | awk 'NR>1 && $1 != "?" {a[$0]++};END{for(val in a) print val}'





      share|improve this answer




























        2












        2








        2







        The issue is due to how certain terminals work. In particular, sakura and gnome-terminal (Ubuntu's default) which I have used before do not register the terminal. There is, in fact, a bug report for gnome-terminal, which is closed with WONTFIX status.



        Finding number of open terminal sessions, therefore, should be focused on finding parent processes of shell sessions or associated pts/tty devices, as shown in this question:



        $ ps -eo tty= | sort -u 


        The only issue with this command is that it should display processes from all users. My personal approach would be to filter out my own processes ( i.e. terminals I opened myself ) via -u option and parse with awk:



        #  Note that this includes tabs as well, not just open windows
        $ ps -u $USER -o tty | awk 'NR>1 && $1 != "?" {a[$0]++};END{for(val in a) print val}'





        share|improve this answer















        The issue is due to how certain terminals work. In particular, sakura and gnome-terminal (Ubuntu's default) which I have used before do not register the terminal. There is, in fact, a bug report for gnome-terminal, which is closed with WONTFIX status.



        Finding number of open terminal sessions, therefore, should be focused on finding parent processes of shell sessions or associated pts/tty devices, as shown in this question:



        $ ps -eo tty= | sort -u 


        The only issue with this command is that it should display processes from all users. My personal approach would be to filter out my own processes ( i.e. terminals I opened myself ) via -u option and parse with awk:



        #  Note that this includes tabs as well, not just open windows
        $ ps -u $USER -o tty | awk 'NR>1 && $1 != "?" {a[$0]++};END{for(val in a) print val}'






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 16 at 10:54

























        answered Jan 16 at 9:47









        Sergiy KolodyazhnyySergiy Kolodyazhnyy

        73.1k9153317




        73.1k9153317






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110203%2fdisplay-all-the-working-terminals%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?