sort and justify output of tmux ls

10 views
Skip to first unread message

Matt Zagrabelny

unread,
Aug 26, 2020, 10:32:48 AM8/26/20
to tmux-users
Greetings,

Here is the current output of tmux ls...

$ tmux ls
104: 1 windows (created Wed Aug 5 08:23:14 2020)
144: 1 windows (created Thu Aug 13 15:45:35 2020)
3: 1 windows (created Mon Jun 22 07:26:56 2020)

I would like the output to be numerically sorted by the id of the
session and also have it justified so the digits line up in their
correct places. Something like this...

$ tmux ls
3: 1 windows (created Mon Jun 22 07:26:56 2020)
104: 1 windows (created Wed Aug 5 08:23:14 2020)
144: 1 windows (created Thu Aug 13 15:45:35 2020)

Is this something that others would like to see? I could open up an
issue on github or take a stab at a patch. What do folks think?

-m

Nicholas Marriott

unread,
Aug 26, 2020, 10:40:13 AM8/26/20
to Matt Zagrabelny, tmux-users
Session names do not need to be numbers but if they are you can do something like this:

tmux ls -F '#{p/-3:session_name}: #{session_windows} windows (created #{t:session_created})#{?session_grouped, (group ,}#{session_group}#{?session_grouped,),}#{?session_attached, (attached),}'|sort -n
> --
> You received this message because you are subscribed to the Google Groups "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAOLfK3UrZz1ccez4%3DZH8WUA3-5G17ZOGjpBv2Sv4QFERRX274g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages