Linux Command Line Basics Part VI: X Window System

Knowing basic *nix terminal commands is an absolute must for any computer pro. Whether you use Windows, Mac OS or Linux, you’re bound to face the command prompt at some stage, so here’s my crash course in CLI. In the previous section of this guide we set up an SSH connection so we could operate a machine remotely. Now it’s time to extend this functionality using the X Window System to provide some remote GUI action to augment the remote CLI access we set up previously.

The X Window System

The X windowing system has been around for the best part of three decades and provides facility for displaying graphical content on a remote computer. Whilst a proficient command line user can perform advanced operations using only text input, some things are undeniably easier using a GUI. By using X, a remote user can wield the power of the command line alongside GUI programs, a formidable combo for a productive user.

One of the best parts of X is how simple it is to add this functionality to your remote session. The only change required from the SSH setup introduced in the previous section is the addition of  ‘-X’ to the beginning or end of the arguments. For example, if user ‘randymarsh’ wants to connect to the remote server ‘125.234.55.211’ with X, he would enter:

$ ssh -X randymarsh@125.234.55.211

Make sure you use a capital X!

For the X forwarding to work, you must have the X window system installed on your local machine. Most Linux installations will include this package, but Mac users will need to install it manually. X11, Apple’s implementation of X, has been included on every Mac OS X disc I’ve ever used, but in case you can’t lay your hands on a disc you can grab it from here.

When you’ve connected, it’s a good idea to start using the ampersands character to return the command line once a program is launched so you can carry on working while your program is running, for example if I wanted to open Nedit in an X11 window but still have access to my CLI:

$ nedit readme.txt &
$

In the image below, the user has launched Nedit on their remote machine and forwarded the GUI to the Macintosh they’re working on using X11.

Nedit running under X11

You can forward basically any program which has a GUI using X, but do remember that the bandwidth you have available will limit the responsiveness of the application. Over a LAN connection you will experience little to no lag, but over a slower connection (like the Internet) you might notice a slowdown.

In the next (and final) part of the guide, we’ll cover one more SSH trick which will help you bypass public network restrictions amongst other things – tunnelling.

For a full list of topics covered in this tutorial series, head over to the index page.

One Response to “Linux Command Line Basics Part VI: X Window System”

  1. […] the next part of the guide, we’ll take a look at some neat SSH tricks, starting with the X window […]

Leave a Reply