The different ways to execute a Linux application
I remember, way back, when I first started using Linux either was either in full-on command line only Linux or I was using Fvwm95. Executing commands in command line meant I had to know the name of the command. And when I was in the Fvwm95 desktop, if there wasn't a menu entry for an application the only other way I could start up an application was to open up the command line and hope I could find the exact command to run. Typically this meant scrolling through the contents of /usr/bin with the command ls -l | less. And in today's Linux (or at least in my main machine) there are approximately 2004 commands within /usr/bin. That could mean a lot of searching.
Fortunately Linux has grown up quite a bit so it's not that difficult to start an application. In fact, I would argue that starting an application in Linux is easier than it is in Windows. How can I say that? Well, why don't we examine the various ways you can start an application within Linux and you can make the judgment yourself.
We'll start with the more challenging first. Not that the command line is difficult, but it's not nearly as easy as finding a menu entry and selecting it.
If you've been following me enough you probably have read an instance where I have mentioned global commands. A global command is a command that is located within your users' $PATH. NOTE: You can learn more about this in my articleÂ "Adding directories to your $PATH". To find out what directories are in your $PATH issue the command echo $PATH. What you see printed out at your prompt are all of the directories which contain commands you can run from anywhere on your system. There may be times when you do not install an application within your path. For those applications you have to enter the explicit path to the executable command. Let me explain...
Say you install the beta version of Firefox (for testing purposes) in the /opt directory. So now you will have a directory /opt/firefox and within that directory is the executable command firefox. Since /opt isn't in your $PATH, if you execute only firefox what will start up is the default firefox on your system. In order to start up Firefox installed in /opt you will have to execute the command /opt/firefox/firefox.
Now let's say you are looking for the apt command to add a gpg key but you're not sure of the name. You are sure, however, of two things: It is in /usr/bin and it has the string "key" in the command. You could issue this command to find all matching commands:
which will list all commands in /usr/bin that contain the word "key". In that listing you will see apt-key. You now know the name of the command.
There are two main (and universal) ways to start up an application in Linux. The first, and easiest, is to look through your main menu for that command's entry. Once you find that command you simply select it to open up the application. One of the issues that is not a universal truth in Linux is menu layout. All Linux desktops lay out their menus differently. But for the most part they hold true to some similarities (Primarily the grouping of applications into submenus like "Office", "Networking", "Graphics", "Games", etc.)
The next universal method of starting up an application is to open up your desktops' file manager, navigate to the directory that contains the executable, and double click on the executable. This is much like it is in Windows. Most often you will be navigating to /usr/bin to find these executables.
NOTE: If a command requires a terminal to run you can not run it in this method. The only commands you can start up this way are graphical commands.
In some desktops you will have a "Run prompt" within your Start menu. In GNOME and KDE you can open up this dialog by pressing Alt-F2. In my favorite distribution, Elive Compiz, I set this to the Windows Key+F1. Figure 1 shows the Run Dialog in Elive. As you can see I want to start the game Torus Trooper. I start to type "torus" and the first matching entry pops up which I can click on to start up the application.
Of course this is Linux so there are many more ways you can find to start up an application. You can create keyboard shortcuts for just about anything or, in some desktops, you can create desktop Icons. In some desktops you can create specific shelves for applications or add mini launchers. But, in general, the methods outlined above will get you through the day in Linux.Advertisement
Since you bring it up with your statement that “you can create keyboard shortcuts for just about anything,” I would appreciate a piece like this about keyboard macros in Linux (I’m using Ubuntu Hardy with the gnome interface). Is there anything in the Linux world comparable to keyboard macros in AlChars, AutoIt or tons of other similar Windows programs? I sure would like to find one/
Thank you it helped me.
“NOTE: If a command requires a terminal to run you can not run it in this method. The only commands you can start up this way are graphical commands.”
You can, if you’re using icewm, by edditing the menu files. For example, in the next line: prog “Navegador Links 2” links2 roxterm -e links2 http://www.google.com.mx
That would launch links 2 at google.com.mx and inside roxterm.
As for other desktops/wm i don’t know… but couldn’t you create a desktop entry at /usr/share/applications ?
A linux user presumably knows how to execute a linux application. For a first-time linux user, this is incomprehensible from ” command line” onwards. I’ve downloaded the file, with the extension applmage. I’ve got my mouse ready. What do I click on? Ubuntu system, first time user, familiar with DOS 5 and windows XP.