# Using X forwarding with screen by proxying $DISPLAY

DevFeed: [Using X forwarding with screen by proxying $DISPLAY](<https://devfeed.tech/articles/using-x-forwarding-with-screen-by-proxying-display-21907.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2010/05/using-x-forwarding-with-screen/>)

Author: Nelson Elhage

Published: 2010-05-30T20:25:52Z

Content type: tutorial

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [Shell](<https://devfeed.tech/topics/shell.md>), [Script](<https://devfeed.tech/topics/script.md>), [Processes](<https://devfeed.tech/topics/processes.md>)

Tags: [local](<https://devfeed.tech/tags/local.md>), [machine](<https://devfeed.tech/tags/machine.md>), [processes](<https://devfeed.tech/tags/processes.md>), [remote](<https://devfeed.tech/tags/remote.md>), [running](<https://devfeed.tech/tags/running.md>), [script](<https://devfeed.tech/tags/script.md>), [server](<https://devfeed.tech/tags/server.md>)

## AI overview

This article presents a shell script that proxies the X11 DISPLAY connection used by screen sessions. It allows graphical programs launched in a persistent remote session to use the most recent X-forwarded connection, while preserving already active windows and terminating obsolete proxy listeners.

## Source excerpt

If you're reading this blog, I probably don't have to explain why I love GNU screen. I can keep a long-running session going on a server somewhere, and log in and resume my session without losing any state. I also love X-forwarding. I love being able to log into a remote server and work in a shell there, but still pop up graphical windows (for instance, gitk's) on my local machine when I need to.