The command line is often mentioned as a tool for starting or setting up Flightgear, Atlas, Terrasync, FGCOM and other programs related to Flightgear. Many users simply don't know, what the command line acutally is or how to make use of it. This article shall help...
As an advice independent from what operating system you may use: Try to use copy & paste as much as you can in order to avoid spelling mistakes, whenever you try to execute command line commands! The command line will do exactly what you tell her and when you spell it wrong, she'll act the wrong way...
On Windows, you have access to the command line by clicking the "Start" button and then chosing "Run...". Type "cmd" (without quotation marks) into the field and hit Enter.
Note: Both Windows XP and Windows Vista might have no "Run..." command in the start menu, when you attempt to try all of this. You can enable the "Run..." command in the "Configure Start Menu" dialog.
You should see the so called prompt now, which says something like that:
Microsoft Windows [Version x.y.zz.abc] Copyright and stuff C:\Windows>_
That says you're operating on drive C in directory Windows. The blinking cursor awaits your commands.
You can simply chance drives by entering <drive-letter>: like that:
C:\Windows> d: D:\>_
And return to drive C in the same way:
D:\> c: C:\Windows>_
Now how about changing the directory? Assuming you downloaded Flightgear into the directory "Flightgear", that is located on drive D and its directory "Games". You do the following:
C:\Windows> d: D:\> cd Games D:\Games> cd Flightgear D:\Games\Flightgear>_
Easy, isn't it? You can also change directly into subdirectories:
C:\Windows> d: D:\> cd Games\Flightgear D:\Games\Flightgear>_
And if you got into the wrong directory somewhere, just try "cd .." to go one directory downwards:
D:\Games\Flightgear> cd .. D:\Games> cd .. D:\>_
That's most you'll need to know about the command line, when operating under Windows. Any commands that appear in the forums or in a wiki can be executed directly on the command line. after you have changed into the correct directory first.
On Linux systems, there are several ways to get a command line. As Flightgear does only run in a graphic X-Window system, we'll use a so-called terminal.
The mosty used window managers are Gnome, KDE and Xfce. First way to get yourself a console would be using the window managers menue: KDE KDE-Menue > System > Konsole Gnome Applications > Accessories > Terminal Xfce Applications > Terminal
A different approach would be pressing Alt F2. That should open a dialog box, where you can enter one single command. Depending on which distribution of Linux you chose and which window manager you use, you can try (all without quotation marks) "xterm", "konsole", "gnome-terminal", "gtkterm", "kterm", "xfce4-terminal"... there's a lot of graphical console emulators!
Now as you've got your console window, it will say something like that:
This (especially the dollar sign) is called the so called "prompt", where username should be the name of the currently logged on user and computername is the name of your computer.
Note the "~" (tilde) sign before the prompt. On Linux systems that sign indicates, that your in your home directory, which normally should be equal to "/home/username".
On Linux systems, you can chance directories equally to the above described Windows method:
username@computername:~$ cd Flightgear username@computername:~/Flightgear$ cd data username@computername:~/Flightgear/data$ _
To go one directory back, you have to use "cd ..":
username@computername:~/Flightgear/data$ cd .. username@computername:~/Flightgear$ cd .. username@computername:~$ _
Now if you downloaded Flightgear to another place than your home directory, you can go anywhere else (remember, that "~" says you are in "/home/username"):
username@computername:~$ cd .. username@computername:/home$ cd .. username@computername:/$ _
Notice, that the "~" sign disappeared, as you went out of your personal home directory from /home/username to /home. The directory "/" is the so called root directory - you can't go downwards from here as all directories are based here.
To change directly to a specific directory, you may use:
username@computername:~$ cd /any/path/you/like username@computername:any/path/you/likehome$ cd /home/username username@computername:~$ cd /some/other/path username@computername:/some/other/path$ cd ~ username@computername:~$ _
Notice, that cd-ing to /home/username produces the "~" sign, indicating, that you're at your home directory, as well as "cd ~" directly brings you there.
Now this should be enough, to change to a desired directory, where commands can be executed.
On Linux, the command line is a very essential tool and it provides a lot of means to do special actions.
To show the content of a directory, use the "ls" command. This for example shows the content of a directory, where flightgear and several other stuff is saved:
username@computername:~/flightgear$ ls download_and_compile_mod.sh plib-1.8.5 run_fgrun.sh download_and_compile_mod.sh~ plib-1.8.5.tar.gz run_fgrun.sh~ download_and_compile.sh run_fgcom.sh run_js_demo.sh fgcom run_fgfs.sh run_js_demo.sh~ fgfs run_fgfs_test.sh run_terrasync.sh fgrun run_fgfs_test.sh~ simgear install run_fgjs.sh OpenSceneGraph run_fgjs.sh~
Now on Linux, you can't simply rename a file into "filename.exe" to attempt to execute it, as you might consider in Windows. In Linux, every file has its restrictions, called mode bits. You can show them by using the "ls" command with option "-l":
username@computername:~/flightgear$ ls -l total 880 -rwxr-xr-x 1 username usergroupname 9138 2009-02-01 14:26 download_and_compile_mod.sh -rw-r--r-- 1 username usergroupname 9156 2009-02-01 14:23 download_and_compile_mod.sh~ -rwxr-xr-x 1 username usergroupname 15263 2009-02-05 21:23 download_and_compile.sh drwxr-xr-x 9 username usergroupname 4096 2009-01-26 21:58 fgcom drwxr-xr-x 4 username usergroupname 4096 2009-01-26 07:26 fgfs drwxr-xr-x 6 username usergroupname 4096 2009-01-26 10:13 fgrun drwxr-xr-x 8 username usergroupname 4096 2009-01-26 21:58 install drwxr-xr-x 15 username usergroupname 4096 2009-02-14 11:19 OpenSceneGraph drwxr-xr-x 4 username usergroupname 4096 2009-02-14 11:18 plib-1.8.5 -rw-r--r-- 1 username usergroupname 779133 2008-03-11 03:16 plib-1.8.5.tar.gz -rwxr-xr-x 1 username usergroupname 167 2009-01-26 21:58 run_fgcom.sh -rwxr-xr-x 1 username usergroupname 162 2009-02-14 12:30 run_fgfs.sh -rwxr-xr-x 1 username usergroupname 916 2009-02-09 22:26 run_fgfs_test.sh -rw-r--r-- 1 username usergroupname 915 2009-02-09 22:26 run_fgfs_test.sh~ -rwxr-xr-x 1 username usergroupname 162 2009-02-09 20:26 run_fgjs.sh -rwxr-xr-x 1 username usergroupname 162 2009-02-09 20:26 run_fgjs.sh~ -rwxr-xr-x 1 username usergroupname 205 2009-02-14 12:31 run_fgrun.sh -rw-r--r-- 1 username usergroupname 218 2009-01-27 23:23 run_fgrun.sh~ -rwxr-xr-x 1 username usergroupname 165 2009-02-09 20:39 run_js_demo.sh -rwxr-xr-x 1 username usergroupname 162 2009-02-09 20:39 run_js_demo.sh~ -rwxr-xr-x 1 username usergroupname 143 2009-02-14 12:30 run_terrasync.sh drwxr-xr-x 3 username usergroupname 4096 2009-01-26 07:20 simgear
Firts, every item has its mode bit, shown on the very left in a scheme of "drwxrwxrwx", followed by a number, the username of the owner (should be the same as of the current user!), the name of the group of the current user, the file size, its last change date and its name. If there is a "-", the specifiy mode bit isn't set.
The first "d" in some of the items indicates a directory. Then, three groups of "rwx" follow. Each "r" means "file/directory may be read", each "w" means "file/directory may be written", each "x" means "file may be executed". The first group of "rwx" shows the rights of the owner of the file, the next group of "rwx" shows the rights of the group of the owner and the last group gives information about what everybody may do with the file.
As there are some scripts out there, that can be downloaded, you have to make them executable in most of the cases (because downloading only sets -rw-r--r-- per default). Making a file executable can be achieved by the "chmod" command. Notice, that "download_and_compile.sh" isn't executable