Tip for setting $DISPLAY when connecting to a Linux machine. — DeepSeek Blog | Neura Market
    Neura MarketNeura Market/DeepSeek
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityTrendingGenerate
    DeepSeekBlogTip for setting $DISPLAY when connecting to a Linux machine.
    Back to Blog
    Tip for setting $DISPLAY when connecting to a Linux machine.
    automation

    Tip for setting $DISPLAY when connecting to a Linux machine.

    Herb Wolfe January 30, 2026
    0 views

    Background: I have an X server running on my Windows machine, and ssh into one of my Linux...

    ## Background: I have an X server running on my Windows machine, and ssh into one of my Linux systems. When I started doing this, I would get the ip address for my Windows machine, export it to the $DISPLAY variable, and run a few simple clients, xeyes, xclock, and an xterm. All this was done manually. ## Slowly simplifying the process: Once I figured out how I wanted the xclock to display, I created an alias for it. Then I put all the commands in a file, which I would run as needed. I still had to set $DISPLAY variable whenever I connected, though. Recently, I discovered that the IP address I connect from is stored as part of both the SSH_CLIENT and SSH_CONNECTION variables in bash. The first step was to figure out how to extract that IP address and assign it to a variable. That was solved with the `echo` and `cut` commands. `ip=$(echo ${SSH_CLIENT} | cut -f1 -d' '):0` That pipes the value of $SSH_CLIENT to the `cut` command, extracting the first field, using a ' ' as the delimiter. I then exported that to the $DISPLAY variable. `export $DISPLAY=$ip` I originally added that to the script I would run to start the X clients. However, I ran into a problem where the $DISPLAY variable wouldn't propagate to the parent shell. So if I wanted to run another client, I had to run the command manually again. That was solved by adding the command to the end of my .bashrc file. I then decided to add a check, in case I wasn't logging in via SSH, so that I would still get a valid value for $DISPLAY. ## The end result: ``` host=$(echo ${SSH_CLIENT} | cut -f1 -d' ') if [ -z $host ]; then host=localhost fi disp=$host:0 export DISPLAY=$disp ```

    Tags

    automationclilinuxproductivity

    Comments

    More Blog

    View all
    How I'm using ASTs and Gemini to solve the "Codebase Onboarding" problem 🧠ai

    How I'm using ASTs and Gemini to solve the "Codebase Onboarding" problem 🧠

    Hi everyone! 👋 I’m Tara, a Senior Software Engineer and Consultant. Over the years, I've jumped...

    T
    tworrell
    Local AI Will Save Us All (The Math Says So, Trust Me)ai

    Local AI Will Save Us All (The Math Says So, Trust Me)

    Every few weeks a take goes viral in tech circles making the case for ditching cloud AI and running...

    S
    Sebastian Schürmann
    Lost in the AI Hype, I Started Smallai

    Lost in the AI Hype, I Started Small

    And it helped me get back into tech without drowning TL;DR at the end Coming back to...

    R
    Rohini Gaonkar
    Building a Replay-Tested Interactive Brokers Client in Gogo

    Building a Replay-Tested Interactive Brokers Client in Go

    I wanted an IBKR library that felt like Go and had testing I could trust. So I wrote one.

    T
    Thomas Marcelis
    Playwright in Pictures: Fully Parallel Modeplaywright

    Playwright in Pictures: Fully Parallel Mode

    Playwright’s fullyParallel mode is often treated as a simple performance switch. In practice, it...

    V
    Vitaliy Potapov
    Designing a CLI for Both Humans and Agentscli

    Designing a CLI for Both Humans and Agents

    Learn how Alpic designed its CLI for both human developers and AI agents — covering tradeoffs like polling, context windows, interactivity, and statelessness.

    J
    Julien Vallini

    Stay up to date

    Get the latest DeepSeek prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for DeepSeek and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.