Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use screen and have ssh sessions open to a number of different machines from within my screen session. I'd like to keep them in order, for obvious reasons. Often I'll have to connect to a new machine which alphabetically/numerically should fit in between two existing windows.

I can't find any way to reorder the windows other than with the "number" command, which swaps my current window with that at the number I specified. So adding a new window to the 15 I already have and then sticking it at position 2, while keeping all the other windows in order as well is cumbersome, to say the least, requiring swaps for all windows past #2.

Is there anyway to sort the windows alphabetically? Or a way to "shift" all windows after a certain point up one spot? Or any other suggestions to insert a new window at an arbitrary point while still maintaining the order of all other windows?


share|improve this question

migrated from Feb 8 '10 at 16:43

This question came from our site for professional and enthusiast programmers.

I don't think it's possible to renumber screens except by the laborious way you've identified.

If you google around, there are people who've written patches for Screen to do almost exactly what you need; so if you're comfortable compiling things from source and applying patches, that may be the way to go.

share|improve this answer
I'm still wondering why this stuff doesn't go upstream. They really want tmux to take over. – nisc Aug 29 '10 at 19:24
What is the point of sorting them? You can't memorize any screen number because every new or closed screen will change your screen numbers. If there are the same machine sessions in most times isn't it better to keep them always at the same location? – Cougar May 28 '12 at 7:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.