114

I learned to use gnu-screen and have been using it for the past several weeks. I got a grip of the basics now, and would be very helpful if I get these queries clarified:

  1. How do I rename / reorder / move windows in Linux screen utility?

    For eg., after a few days of use, I come to a state where the window-numbers are 2, 3, 6, 8. Now I want a new-window to be created at #9, or #7. Is this possible? If yes, how?

    Also, is it possible to 'move' the window #6 to #4 or #7? If yes, how?

  2. Scrolling shortcut: Scroll takes Ctrl-A + Esc, and then Ctrl-u / Ctrl-d. Is there a way to map PgUp / PgDn to do these directly? Or, is there a way to map some key (like F5) to take me to copy mode, and then PgUp / PgDn for scrolling?

  3. I have enabled "caption always", so the current window title is displayed always at the bottom. Is there a way to display the current window's log-file-name and logging status (on/off) in the same caption bar?

T. Zengerink
  • 199
  • 5
  • 13
Rangzy
  • 1,241
  • 2
  • 9
  • 5
  • 37
    `:number X` moves window to specific position – Ency Mar 07 '11 at 18:08
  • Check this out `hardstatus string "%{.kG}%-Lw%{.KW}%n%f %t%{-}%+Lw %=%{..G} %H %{..W} %d/%m %C%a "` it provides a lot of information (Z$L..) for all windows at time – Ency Mar 07 '11 at 20:52
  • Ency : thanks for the hardstatus string tip. It shows lot of details, but not the logfile name and status info. Any idea on this ? – Rangzy Mar 08 '11 at 08:50
  • You may want to look at the source for Byobu. Byobu is a very nice configuration package for Screen which takes a lot of advantage of the bottom bar: https://launchpad.net/byobu Bostonvaulter's suggestion of tmux is good too if that's available to you. If you have to log on to a lot of systems you don't necessarily have a lot of control over, it's good to know Screen since it's more widely available. – entropo Apr 02 '11 at 04:00
  • I would highly suggest you try [tmux](https://tmux.github.io/) instead. It has many more features than screen and is much better at managing windows. For example you can do a vertical split whereas with screen you can only do a horizontal split. – Jason Axelson Apr 02 '11 at 01:51
  • 1
    That's not true, in screen do ctrl+A ctrl+| for a vertical split – Nick Garvey Aug 14 '12 at 00:51
  • 1
    @NickGarvey the vertical split patch for screen is not in GNU Screen. It is a patch that is applied by some distros. – Jason Axelson Aug 14 '12 at 01:18
  • moved to github: https://tmux.github.io/ – david Aug 12 '16 at 16:33

2 Answers2

149

You can renumber the current window with ctrl+a :number x where x is a numeric argument.

You can rename the current window with ctrl+a A

kevin
  • 143
  • 7
Jacob Vanus
  • 1,591
  • 1
  • 9
  • 4
  • 14
    Renumbering even works if the new number is already in use. In this case the windows exchange their numbers. Nice. – Uwe Geuder Dec 17 '12 at 14:16
  • 5
    I was a little confused at first. You have to type the literal string "number" and x is the kind of parameter to the number renaming function. – rrenaud Sep 06 '14 at 21:10
  • 3
    More symetrically and easier to remember you can do: `ctrl+a` `:title new window title` – Wadih M. Feb 14 '16 at 01:27
  • @WadihM. just so long as there's no spaces in the new_window_title – 22degrees Mar 31 '16 at 21:08
46

You can move windows up and down with this:

ctrl+a :windowlist then . (dot)-down and , (comma)-up

or

ctrl+a " then . (dot)-down and , (comma)-up

(From here.)

weinerk
  • 591
  • 4
  • 5