31

I have access to a cluster and wanted to use the simplest example to ssh into it with X11 forwarding and see if it works. Currently, I simply log into the cluster:

$ ssh -Y user@cluster

and the only program that I know in the cluster that has some display (like a gui) is matlab, so I just run it:

$ matlab

in the past that works but I wanted to know of the simplest command to display something in my screen to see if its working or not. Currently, running matlab opens the command interface but it doesn't display an error or anything else.

Does someone know what is an alternative command to see if anything is working? A single command that is inherit with Ubuntu and doesn't require me to install anything beyond X11 is the idea. Something like:

$ display_a_box_with_text HELLOWORLD

I am not sure if its just me but it seems ridiculous that the only way to check if X11 is working is by running MATLAB. There must be a better way to check this.

5
  • 3
    Run the command: xeyes. Sep 13, 2016 at 18:14
  • @L.D.James that command wasn't found. For the record, matlab works now (for some reason -Y didn't work in the system I was using, though it seems ridiculous to me that the only way to check if it even works if by running matlab. Might work for me but not for general user) Sep 13, 2016 at 18:23
  • 8
    xeyes, xclock, oclock, xcalc, xgc, xedit, xlogo, xman are pretty standard X11 applications. They are included in the packet x11-apps.
    – nobody
    Sep 13, 2016 at 18:39
  • @Pinocchio Have you tried something from my answer? Sep 14, 2016 at 14:31
  • @ThiagoRiderAugusto yes I tried the -v and -Y and xterm. That opened a window through XQuartz, so I assume that worked. Thanks! Sep 16, 2016 at 17:31

4 Answers 4

36

Instead of the ssh command you issued, try:

$ ssh -v -Y user@cluster

Add another argument -v enable the debugging mode for ssh command. Search for a line containing Requesting X11 forwarding, like in:

$ ssh -v -Y user@cluster
[...]
debug1: Requesting X11 forwarding with authentication spoofing.
[...]

After logging in, you can try the following commands for opening a X window: xterm, xclock, xcalc, xedit, etc These were already mentioned in comments.

You asked for a dialog box with a custom text, so you should try xmessage:

$ xmessage -center hello!
2
  • 2
    The only command the cluster I am using had was xterm. I can't install any of the other commands because I am not sudo, but xterm worked just fine! Thx. Sep 16, 2016 at 17:32
  • xmessage worked for me. Thanks!
    – Roger V.
    Feb 9, 2021 at 15:49
1

In case you don't have xmessage, these are alternatives:

  • xdg-open . (sudo apt install xdg-utils)
  • xterm

Those worked on my CentOS 7 server at work.

2
  • these gives me "command not found"
    – Sarah
    Dec 26, 2022 at 10:37
  • 1
    Thanks for the feedback, updated. Dec 31, 2022 at 0:48
1

You can try three things

  1. xeyes
  2. xclock
  3. xmessage -center hello!
-2

Here is an answer taken from this post:

To check whether X11 forwarding is enabled, look at the value of the DISPLAY environment variable: echo $DISPLAY. You should see a value like localhost:10 (applications running on the remote machine are told to connect to a display running on the same machine, but that display connection is in fact forwarded by SSH to your client-side display). Note that if DISPLAY isn't set, it's no use setting it manually: the environment variable is always set correctly if the forwarding is in place

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .