Tip for setting $DISPLAY when connecting to a Linux…
    Neura MarketNeura Market/DeepSeek
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityTrending
    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
    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught megemma

    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught me

    I ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...

    X
    xbill
    Hey DEV, I'm Tobore. Let's actually connect.community

    Hey DEV, I'm Tobore. Let's actually connect.

    Hey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...

    L
    Laurina Ayarah
    I burned through thousands of AI tokens. Then a friend did it for freeai

    I burned through thousands of AI tokens. Then a friend did it for free

    (yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...

    P
    Paulo Henrique
    Claude might be saturating your machineai

    Claude might be saturating your machine

    My laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...

    S
    Sidhant Panda
    Automated GitHub Code Reviews Using Google Geminigithubactions

    Automated GitHub Code Reviews Using Google Gemini

    I Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...

    D
    Darren "Dazbo" Lester
    What is an "agentic harness," actually?ai

    What is an "agentic harness," actually?

    I've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...

    T
    Tilde A. Thurium

    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.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions for your business.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this DeepSeek resource

    • Automate Blog Content Creation with Notion MCP, DeepSeek AI, and WordPressn8n · $9.99 · Related topic
    • Automate Background Removal with MCP Server for AI Agentsn8n · $9.99 · Related topic
    • Generate AI Videos from Scripts with DeepSeek, Synthesia, and Together.ain8n · $24.99 · Related topic
    • Compare Multi-Period Financial Data from Google Sheets with DeepSeek AI Analysisn8n · $14.99 · Related topic
    Browse all workflows