【问题标题】:find number of gnome-terminal tabs currently open by window Id查找当前按窗口 ID 打开的 gnome-terminal 选项卡的数量
【发布时间】:2013-12-05 13:21:14
【问题描述】:

如何查看终端中打开的标签页数?

我可以通过使用xwininfo -name 并给出其中一个选项卡的名称来获取窗口的 ID。例如:

xwininfo -name "<name of a tab>" 在我的机器上导致:

xwininfo: Window id: 0x3000006 "<name of tab>"

...some more info

有没有办法知道当前打开的标签数量?我将Ubuntutcsh 一起使用,但也欢迎bash 解决方案,因为它们可能会暗示tcsh 的解决方案。

【问题讨论】:

    标签: linux bash ubuntu terminal tcsh


    【解决方案1】:

    你可以试试这样的:

    ps --ppid $(pgrep gnome-terminal)  | grep tcsh | wc -l
    

    【讨论】:

    • 不错,但不需要wc -l。只需执行... grep -c tcsh。另外,我会让模式更通用,不仅可以匹配tcsh,还可以匹配其他shell:... grep -cE '(ba|tc|z|c)?sh$
    猜你喜欢
    • 2019-04-01
    • 1970-01-01
    • 2013-10-29
    • 1970-01-01
    • 2013-05-07
    • 1970-01-01
    • 1970-01-01
    • 2018-09-30
    • 1970-01-01
    相关资源
    最近更新 更多