Command line: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''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...
'''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 aren't aware of the command line or how to make use of it. This article may help...
 
Operating System independent advice:
'''Try to use copy & paste as much as possible in order to avoid spelling mistakes, whenever you try to execute command line commands!'''
The system will do ''exactly'' what you tell it on the command line and when you get it wrong, the system will do it wrong.
 
== Windows ==
On Windows, you can get to the command line by clicking the "Start" button and then choosing "Run...". As a handy shortcut to the "Run..." prompt: Hold down the "Windows" key (the one with the windows flag on it) and tap the "R" key.
 
Type "cmd" (without quotation marks) into the field and hit Enter.


==Windows XP==
On Windows XP, 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.


You should see the so called ''prompt'' now, which says something like that:
You should see the so called ''prompt'' now, which says something like that:


  USE_PA_OSS=0
  Microsoft Windows [Version x.y.zz.abc]
  USE_PA_ALSA=0
  Copyright and stuff
  USE_PA_JACK=0
   
  AUDIO_ALSA=0
  C:\Windows>_
AUDIO_OPENAL=1


''italic''
That says you're operating on drive C in directory Windows. The blinking cursor awaits your commands.
'''bold'''


==Caption==
You can simply change drives by entering <drive-letter>: as shown below:
===Sublevel Caption===


C:\Windows> d:
D:\>_


===Configuration===
And return to drive C in the same way:


''Or if it didn't work perfectly first time''
D:\> c:
C:\Windows>_


    fgcom --help
Now how about changing the directory? Assuming you downloaded Flightgear into the directory "Flightgear", that is located on drive D and its directory "Simulators". You do the following:


returns the following useful info
C:\Windows> d:
D:\> cd Simulators
D:\Simulators> cd Flightgear
D:\Simulators\Flightgear>_


    fgcom - a communication radio based on VoIP with IAX/Asterisk
Easy, isn't it? You can also change directly into subdirectories:
    (c)2007 by H. Wirtz <wirtz@dfn.de>
    Version 1.2.2 build 163M
    Using iaxclient library Version SVN 163M


  OPTION                                        DESCRIPTION
C:\Windows> d:
D:\> cd Games\Flightgear
D:\Games\Flightgear>_


  -d, -debug, --debug=                          show debugging information
And if you got into the wrong directory somewhere, just try "cd .." to go one directory downwards:
  -S, -voipserver, --voipserver=                voip server to connect to (default: 'fgcom1.parasitstudio.de')
  -s, -fgserver, --fgserver=                    fg to connect to  (default: 'localhost')
  -p, -port, --port=                            where we should listen to FG (default: '16661')
  -a, -airport, --airport=                      airport-id (ICAO) for ATC-mode
  -f, -frequency, --frequency=                  frequency for ATC-mode
  -U, -user, --user=                            username for VoIP account (default: 'guest')
  -P, -password, --password=                    password for VoIP account (default: 'guest')
  -i, -mic, --mic=                              mic input level (0.0 - 1.0)
  -o, -speaker, --speaker=                      speaker output level (0.0 - 1.0)
  -b, -mic-boost, --mic-boost=                  enable mic boost
  -l, -list-audio, --list-audio=                list audio devices
  -r, -set-audio-in, --set-audio-in=            use <devicename> as audio input
  -k, -set-audio-out, --set-audio-out=          use <devicename> as audio output
  -c, -codec, --codec=                          use codec <codec> as transfer codec (default: 'u')


  Available codecs:
D:\Games\Flightgear> cd ..
        u - ulaw (default and best codec because the mixing is based onto ulaw)
D:\Games> cd ..
        a - alaw
D:\>_
        g - gsm
        s - speex
        7 - G.723


  Mode 1: client for COM1 of flightgear:
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.
        $ fgcom
  - connects fgcom to fgfs at localhost:16661
        $ fgcom -sother.host.tld -p23456
  - connects fgcom to fgfs at other.host.tld:23456


  Mode 2: client for an ATC at <airport> on <frequency>:
== Linux ==
        $ fgcom -aKSFO -f120.500
=== Basics ===
  - sets up fgcom for an ATC radio at KSFO 120.500 MHz
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''.


    Note that /home/hcs/src/fgcom/trunk/src/fgcom starts with a guest account unless you use -U and -P!
The most often used window managers are Gnome, KDE and Xfce. One way of getting to a console would be using the window managers menu:
* '''KDE''' KDE-Menue > System > Konsole
* '''Gnome''' Applications > Accessories > Terminal
* '''Xfce''' Applications > Terminal


Also note that the current server (fgcom.flightgear.co.uk) works with guest account, so '''do not use -U or -P'''
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:


username@computername:~$_


==Server installation==
This (especially the dollar sign) is the so called "prompt", where ''username'' should be the name of the currently logged on user and ''computername'' is the name of your computer. If your prompt is "#" instead of "$", you are logged in as root (superuser) and probably shouldn't be.


For running a FGCOM server you need Asterisk and depending on the amount of users much bandwith and CPU power. Because of putting pilots and ATCs in a VoIP conference the server-admin has to assure that there is enough network and cpu power to avoid drop-outs of the voice stream.
Note the "~" (tilde) sign before the prompt. On Linux systems that sign indicates, that you're in your home directory, which normally should be equal to "/home/username".


===Prerequirements===
On Linux systems, you can change directories equally to the above described Windows method:


Install Asterisk on top of your favorite distribution. Please refer to installation manuals (e.g. [[http://www.asteriskguru.com/|Asterisk-Guru]]) you can find on the net. You do not need H.323 or SIP because the fgcom client uses IAX2 as VoIP signaling protocol. Only if you think about connecting external VoIP applications to FGCOM you should consider to activate H.323 or SIP (but this is not the scope of this small howto).
username@computername:~$ cd Flightgear
username@computername:~/Flightgear$ cd data
username@computername:~/Flightgear/data$ _


Notice: You need to install the zaptel driver modules - even if you won't use any hardware for telecom interfacing. You need the ztdummy kernel module for the asterisk conference application MeetMe() because it simulates a hardware clock needed by this application. Further development of FGCOM might use app_conference which don't needs any timing device.
To go one directory back, you have to use "cd ..":


For now we want to use /etc/asterisk as the base configuration directory.
username@computername:~/Flightgear/data$ cd ..
username@computername:~/Flightgear$ cd ..
username@computername:~$ _


===Setting up the radio frequencies===
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"):


The radio frequencies are "simple" Conferences and realized due to the Asterisk application MeetMe().
username@computername:~$ cd ..
username@computername:/home$ cd ..
username@computername:/$ _


====Part 1: General configuration====
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.


First you have to set up the general configuration of the system. Put the following at the top of your "extensions.conf" file:
To change directly to a specific directory, you may use:


  [general]
username@computername:~$ cd /any/path/you/like
  static=yes
username@computername:/any/path/you/like$ cd /home/username
  writeprotect=yes
username@computername:~$ cd /some/other/path
  ;
username@computername:/some/other/path$ cd ~
  [globals]
username@computername:~$ _
  ;
  [macro-com]
  exten => s,1,Answer()
  exten => s,n,MeetMe(${MACRO_EXTEN},qd)
  exten => s,n,Hangup()
  ;
  [macro-echo]
  exten => s,1,Answer()
  exten => s,n,Echo()
  exten => s,n,Hangup()
  ;
  [guest]
  ; ATC-Help
  exten => 01-ZZZZ-911.000,1,Macro(com)
  exten => 012525252591100,1,Dial(Local/01-ZZZZ-911.000)
  exten => 01-ZZZZ-910.000,1,Macro(echo)
  exten => 012525252591000,1,Dial(Local/01-ZZZZ-910.000)
  ;
  [default]
  include => guest
  ;
  ; Code:
  ; 01 - FlightGear
  ; 02 - Microsoft Flight-Simulator
  ; 03 - ...
  ;
  ; Air2Air
  exten => 01-ZZZZ-123.450,1,Macro(com)
  exten => 012525252512345,1,Dial(Local/01-ZZZZ-123.450)
  exten => 01-ZZZZ-122.750,1,Macro(com)
  exten => 012525252512275,1,Dial(Local/01-ZZZZ-122.750)


====Part 2: Adding your favorite (all?) frequencies====
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.


For this you have simply to create an extension for every touple of airport/frequency in extensions.conf. The following is an example for Berlin-Tempelhof (EDDI). The information comes from the file "apt.dat.gz" of your FlightGear installation.
One last note, before we finish this thing:


  ; EDDI ATIS 126.020 - Berlin Tempelhof
''Linux systems are case sensitive, so you have use the correct case sensitive spelling of files and directories. Otherwise the command line won't act as expected!''
  exten => 01-EDDI-126.020,1,Macro(com)
  exten => 010403030812602,1,Dial(Local/01-EDDI-126.020)
  ;
  ; EDDI BERLIN DEP 120.620 - Berlin Tempelhof
  exten => 01-EDDI-120.620,1,Macro(com)
  exten => 010403030812062,1,Dial(Local/01-EDDI-120.620)
  ;
  ; EDDI BERLIN DIRECTOR 121.120 - Berlin Tempelhof
  exten => 01-EDDI-121.120,1,Macro(com)
  exten => 010403030812112,1,Dial(Local/01-EDDI-121.120)
  ;
  ; EDDI BERLIN ARR 126.420 - Berlin Tempelhof
  exten => 01-EDDI-126.420,1,Macro(com)
  exten => 010403030812642,1,Dial(Local/01-EDDI-126.420)
  ;
  ; EDDI GND 121.950 - Berlin Tempelhof
  exten => 01-EDDI-121.950,1,Macro(com)
  exten => 010403030812195,1,Dial(Local/01-EDDI-121.950)
  ;
  ; EDDI TWR 119.570 - Berlin Tempelhof
  exten => 01-EDDI-119.570,1,Macro(com)
  exten => 010403030811957,1,Dial(Local/01-EDDI-119.570)
  ;
  ; EDDI BERLIN DIRECTOR 136.100 - Berlin Tempelhof
  exten => 01-EDDI-136.100,1,Macro(com)
  exten => 010403030813610,1,Dial(Local/01-EDDI-136.100)
  ;
  ; EDDI TWR 118.100 - Berlin Tempelhof
  exten => 01-EDDI-118.100,1,Macro(com)
  exten => 010403030811810,1,Dial(Local/01-EDDI-118.100)
  ;
  ; EDDI BERLIN DEP 119.500 - Berlin Tempelhof
  exten => 01-EDDI-119.500,1,Macro(com)
  exten => 010403030811950,1,Dial(Local/01-EDDI-119.500)
  ;
  ; EDDI BERLIN ARR 119.620 - Berlin Tempelhof
  exten => 01-EDDI-119.620,1,Macro(com)
  exten => 010403030811962,1,Dial(Local/01-EDDI-119.620)


What does the above mean? There are two lines (three with the comment) for each frequency: The first one sets up an extension named "01-EDDI-119.500". Yes, for VoIP you can use textual extensions but be careful if you want to setup your Asterisk-Server with POTS (=Plain old telephone service). Therefor you need the second line which is the same as above but without dashes and the letters in the decimal representation of the ASCII Code. The second line does only a "rewrite" of the numerical representation to the textual one.
Now this should be enough, to change to a desired directory, where commands can be executed.


For setting up all airports you can write your own simple script. But this maybe also not needed in further versions of FGCOM.
=== Special commands ===
On Linux, the command line is a very essential tool and it provides a lot of means to do special actions.


After editing the extensions.conf file you have to reload the extensions file (e.g. "asterisk -rx extensions reload").
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:


You can add further nice goodies to your extensions.conf: MorseCode() for morsing the code of the VOR (MorseCode() will only work in Asterisk >= 1.4), Recording of metar data and playing this recording back when using the frequency of the metar information, ...
username@computername:~/flightgear$ ls
   
download_and_compile_mod.sh  plib-1.8.5        run_fgrun.sh
===Setting up user accounts===
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~
 
Okay. Imagine, you just want to know about the files and directories containing the sequence "run". In order to achieve this, you can pass the output of the "ls" command to another program. A very common filter program is "grep". You use "grep" by telling the program what to filter. Directing the output of "ls" to "grep" (filtering for "run") is done by using the ''pipe'' symbol: "|"
 
username@computername:~/flightgear$ ls | grep run
fgrun
run_fgcom.sh
run_fgfs.sh
run_fgfs_test.sh
run_fgfs_test.sh~
run_fgjs.sh
run_fgjs.sh~
run_fgrun.sh
run_fgrun.sh~
run_js_demo.sh
  run_js_demo.sh~
run_terrasync.sh


The user accounts are located in the file iax.conf (and perhaps also in sip.conf, but this is not necessary). The top of the file should look like this:
Easy, isn't it?


  [general]
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":
  bandwith=low
  disallow=lpc10
  jitterbuffer=yes
  forcejitterbuffer=no
  tos=lowdelay
  autokill=yes
  disallow=all
  allow=alaw
  allow=gsm
  allow=ilbc
  allow=g726
  allow=ulaw
  language=en
  maxauthreq=10
  context=guest
  ;
  [guest]
  type=user
  username=guest
  context=guest
  qualify=yes
  callerid=Guest IAX User
  host=dynamic
  ;


You may want to disallow more codecs or want to allow additional codecs (such as speex). But have in mind that the internal mixing of the conferences are done in "ulaw". But "ulaw" needs about 80 kBit/s because it does no compression. So you have to think about what's better for you: less bandwidth (per user) and more CPU usage or more bandwidth (per user) and less CPU usage... you should also consider the "sound" of some codecs may not have the 'real radio sound'.
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


For each user you have to add a bunch of lines to your iax.conf file:
First, 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 owner, file size, its last change date and its name. If there is a "-" (minus) sinstead of a character in the ''drwxrwxrwx'' sequence, the specific mode bit isn't set.


  [<USERNAME>]
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".
  type=user
  username=<USERNAME>
  secret=<PASSWORD>
  context=default
  host=dynamic
  nat=yes
  notransfer=yes


You just have to fill in the <USERNAME> and <PASSWORD>. After each change you have to reload the configuration (e.g. "asterisk -rx reload chan_iax2.so"). Perhaps you want to write scripts for automatic configuration and so on. But be warned: Further versions of fgcom may use the multiplayer servers for getting usernames and position data and you have to change your scripts.
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 of ''rwx'' gives information about what everybody else may do with the file.


===Problems?===
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. We use the "ls" command with its "-l" option and the ''pipe'' to filter the output of "ls" by "grep":


If you have problems you can contact me via email at "dcoredump AT gmail.com".
username@computername:~/flightgear$ ls -l | grep download_and_compile.sh
-rwxr-xr-x  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh
username@computername:~/flightgear$ chmod -x download_and_compile.sh
username@computername:~/flightgear$ ls -l | grep download_and_compile.sh
-rw-r--r--  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh
username@computername:~/flightgear$ chmod +x download_and_compile.sh
username@computername:~/flightgear$ ls -l | grep download_and_compile.sh
-rwxr-xr-x  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh


==External links==
Notice, that "download_and_compile.sh" at first had the executable bits all set, then we take them away by "chmod -x" and give them back by "chmod +x". You can do the same with read and write rights.
* [http://squonk.abacab.org/dokuwiki/fgcom Official website]
* [http://squonk.abacab.org/dokuwiki/fgcom-manual Manual]


==Development==
That should be enough of command line knowledge, to perform several command line actions related to Flightgear and its Addons so far.


TODO
== Related content ==
=== Wiki articles ===
* [[Command line options]]


==See also==
== External links ==
*[[FlightGear related projects]]
* [https://help.ubuntu.com/community/UsingTheTerminal?action=show&redirect=BasicCommands Ubuntu wiki page on the command line]


[[Category:Software]]
[[Category:Howto]]

Latest revision as of 16:13, 15 October 2015

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 aren't aware of the command line or how to make use of it. This article may help...

Operating System independent advice: Try to use copy & paste as much as possible in order to avoid spelling mistakes, whenever you try to execute command line commands! The system will do exactly what you tell it on the command line and when you get it wrong, the system will do it wrong.

Windows

On Windows, you can get to the command line by clicking the "Start" button and then choosing "Run...". As a handy shortcut to the "Run..." prompt: Hold down the "Windows" key (the one with the windows flag on it) and tap the "R" key.

Type "cmd" (without quotation marks) into the field and hit Enter.


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 change drives by entering <drive-letter>: as shown below:

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 "Simulators". You do the following:

C:\Windows> d:
D:\> cd Simulators
D:\Simulators> cd Flightgear
D:\Simulators\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.

Linux

Basics

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 most often used window managers are Gnome, KDE and Xfce. One way of getting to a console would be using the window managers menu:

  • 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:

username@computername:~$_

This (especially the dollar sign) is the so called "prompt", where username should be the name of the currently logged on user and computername is the name of your computer. If your prompt is "#" instead of "$", you are logged in as root (superuser) and probably shouldn't be.

Note the "~" (tilde) sign before the prompt. On Linux systems that sign indicates, that you're in your home directory, which normally should be equal to "/home/username".

On Linux systems, you can change 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/like$ 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.

One last note, before we finish this thing:

Linux systems are case sensitive, so you have use the correct case sensitive spelling of files and directories. Otherwise the command line won't act as expected!

Now this should be enough, to change to a desired directory, where commands can be executed.

Special commands

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~

Okay. Imagine, you just want to know about the files and directories containing the sequence "run". In order to achieve this, you can pass the output of the "ls" command to another program. A very common filter program is "grep". You use "grep" by telling the program what to filter. Directing the output of "ls" to "grep" (filtering for "run") is done by using the pipe symbol: "|"

username@computername:~/flightgear$ ls | grep run
fgrun
run_fgcom.sh
run_fgfs.sh
run_fgfs_test.sh
run_fgfs_test.sh~
run_fgjs.sh
run_fgjs.sh~
run_fgrun.sh
run_fgrun.sh~
run_js_demo.sh
run_js_demo.sh~
run_terrasync.sh

Easy, isn't it?

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

First, 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 owner, file size, its last change date and its name. If there is a "-" (minus) sinstead of a character in the drwxrwxrwx sequence, the specific 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 of rwx gives information about what everybody else 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. We use the "ls" command with its "-l" option and the pipe to filter the output of "ls" by "grep":

username@computername:~/flightgear$ ls -l | grep download_and_compile.sh 
-rwxr-xr-x  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh
username@computername:~/flightgear$ chmod -x download_and_compile.sh 
username@computername:~/flightgear$ ls -l | grep download_and_compile.sh 
-rw-r--r--  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh
username@computername:~/flightgear$ chmod +x download_and_compile.sh 
username@computername:~/flightgear$ ls -l | grep download_and_compile.sh 
-rwxr-xr-x  1 username usergroupname  15263 2009-02-05 21:23 download_and_compile.sh

Notice, that "download_and_compile.sh" at first had the executable bits all set, then we take them away by "chmod -x" and give them back by "chmod +x". You can do the same with read and write rights.

That should be enough of command line knowledge, to perform several command line actions related to Flightgear and its Addons so far.

Related content

Wiki articles

External links