Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was wondering if there is a way to get which window number of screen that is active? As in: screen -X get-window-number I have found no way to list screen windows to output, only the actual screens.

The reason I would like to do this is because I use screen quite a lot and it would be nice to always see the screen number I'm currently at. I planned to incorporate that into the bash PS1 so it would come to look something like: [16:00:00][0]admin@Server:/etc$ so it would be [time][window number]username@hostname:pwd$

Does anyone have a way of doing that?

share|improve this question

migrated from stackoverflow.com Sep 21 '13 at 22:18

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

    
Have you considered enabling the status line? –  chepner Sep 20 '13 at 14:11

1 Answer 1

up vote 2 down vote accepted

You can use $WINDOW variable which is set to the window number of a screen window at creation time. It's as easy as

echo $WINDOW
share|improve this answer
    
Wow thanks, exactly what I was looking for! –  Lasse Halberg Haarbye Sep 20 '13 at 14:25

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.