Starting Programs from the Shell

The most obvious, but perhaps not so apparent, use of the shell is to start other programs. Most utilities you use in Linux are separate and distinct executable programs. Users need a method to start these programs. In the GUI, you can associate an icon with a particular program, and the graphical environment contains the intelligence to start the program. Note that programs often require information drawn from environment variables, which are a part of the shell environment. (I discuss environment variables in more detail in the section “Working with Variables,” later in this chapter.) For this reason, the GUI often calls the intended program via the bash shell. So you see, even the GUI finds the shell a necessity — although the GUI does its best to hide this detail from users.

For example, in the GUI after you have a terminal window open, type the following command at the prompt:

 mahjongg                                                            

After a few seconds, the Mahjongg game is displayed. You can start any program at a command prompt that you can click from the GNOME menu if you know what the underlying program name is. Note that if you’re in a virtual terminal (press Alt+F1) rather than the GUI, you may see an error message. Some programs require a graphical environment in which to run, which a character-based terminal obviously doesn’t have.

Get Linux® For Dummies®, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.