diff --git a/site/pages/cmd/interm/ifConfig.html b/site/pages/cmd/interm/ifConfig.html new file mode 100644 index 0000000..a90eafb --- /dev/null +++ b/site/pages/cmd/interm/ifConfig.html @@ -0,0 +1,61 @@ +--- +layout: page +category-page: intermediate +category-title: Intermediate commands +tags: command IfConfig +author: Matteo Omenetti +title: IfConfig +--- + + IfConfig stands for "Interface Configuration". It is used +to configure, control, and query network interface parameters of your system.
+If you try running this command with no arguments, it will simply display information +about all network interfaces currently active.
+{% highlight bash %} + ifConfig +{% endhighlight %} +The output sill resembles something like this, of course it changes from machine +to machine: + +
+en5: flags=8863 UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST mtu 1500
+	ether ac:de:48:00:11:22
+	inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x8
+	nd6 options=201 PERFORMNUD,DAD
+	media: autoselect (100baseTX full-duplex)
+	status: active
+
+ap1: flags=8802 BROADCAST,SIMPLEX,MULTICAST mtu 1500
+	ether f2:18:98:41:74:42
+	media: autoselect
+	status: inactive
+
+  ...
+
+ + +If you want to view the configuration of all network interfaces, not just the ones currently active, you can use +flag a. +{% highlight bash %} +IiConfig -a +{% endhighlight %} + +If you want to view the configuration of a specific interface, you can specify the name of the interface +you want to view after the command IfConfig: +{% highlight bash %} + ifConfig ap1 +{% endhighlight %} +This command will show only the configuration of ap1. + +To enable an interface, you can use the command ifConfig with the name of the interface +you want to enable, followed by the key word up. +However, enabling or disabling a device, is a privilege reserved for the super user, therefore you also +have to use the command sudo. +{% highlight bash %} + sudo ifConfig ap1 up +{% endhighlight %} + +To disable an interface, you can follow the same procedure, this time using the key word down. +{% highlight bash %} + sudo ifConfig ap1 down +{% endhighlight %} diff --git a/site/pages/scripts/for-loop.html b/site/pages/scripts/for-loop.html index b455b18..f6cc816 100644 --- a/site/pages/scripts/for-loop.html +++ b/site/pages/scripts/for-loop.html @@ -9,16 +9,16 @@ title: For Loop The second type of loops are for loops. -They follow this sintax: +They follow this syntax: {% highlight bash %} for [variable] in [list] do [code] done {% endhighlight %} -Their purpose is to iterate over a list. Also while loops could do this, you might argue...
-Of course they could, but for loops are specifically meant to do this. Therefore, for instance, -you don't have to decleare your counter variable outside the loop. Most importantly, +Their purpose is to iterate over a list. Also, while loops could do this, you might argue...
+Of course, they could, but for loops are specifically meant to do this. Therefore, for instance, +you don't have to declare your counter variable outside the loop. Most importantly, this variable can be accessed from inside the loop.
For loops take this form: @@ -53,12 +53,12 @@ The output of this piece of code is: - + There are also other ways to specify the numerical range . For instance, if your numerical range is too big, you can simply write: {1..100} . This piece of code means every natural number between 1 and 100 (both included).
Ranges can also count backward like this: {10..1}. -You can even icrement the numerical value by step of two: {0..10..2} . +You can even increment the numerical value by step of two: {0..10..2} . This piece of code means every natural number between 0 and 10 with a step of two, 0 2 4 6... 10. - + diff --git a/site/pages/scripts/if.html b/site/pages/scripts/if.html index 3701b32..e0c2b8e 100644 --- a/site/pages/scripts/if.html +++ b/site/pages/scripts/if.html @@ -21,7 +21,7 @@ if [condition]; then fi {% endhighlight %} -Anything between then and fi will be executed only if the condtion +Anything between then and fi will be executed only if the condition evaluates to true.
Here is a simple example: @@ -33,9 +33,9 @@ if [$i -ge 200]; then fi {% endhighlight %} -In this first example we evaluate a varibale i to 105. +In this first example we evaluate a variable i to 105. The if statement will print "You chose a big number" -only if the number contained in our varibale i is Greater or +only if the number contained in our variable i is Greater or Equal to 200.
This is our case, therefore the output of this piece of code will be:
@@ -47,7 +47,7 @@ This is our case, therefore the output of this piece of code will be:
 
 

If Else

-Sometimes we want to perform a certain set of actions, if our condtion evaluates to +Sometimes we want to perform a certain set of actions, if our condition evaluates to true and another set of actions if our condition evaluates to false. We can do this with the if else statement. if else sattements take this form: @@ -76,12 +76,12 @@ else fi {% endhighlight %} -In this example, that is just an extention of the previuous example, we -evealuate a variable i to 50. If i is gretaer or equal to +In this example, that is just an extension of the previous example, we +evaluate a variable i to 50. If i is greater or equal to 200, you print out "You chose a big number", otherwise, -(if i is not gretaer or equal to 200), just like in this case, you print out +(if i is not greater or equal to 200), just like in this case, you print out "You chose a small number". -Therefore the output of this piece of code is: +Therefore, the output of this piece of code is:
   You chose a small number.
@@ -91,8 +91,8 @@ Therefore the output of this piece of code is:
 
 
 

If Elif Else

-Sometimes, in programming, it is necessary to have a series of condtions that lead to different paths. -We can accomodate this need with the if else elif mechanism. +Sometimes, in programming, it is necessary to have a series of conditions that lead to different paths. +We can accommodate this need with the if else elif mechanism. The if else elif mechanism takes this form: {% highlight bash %} @@ -128,11 +128,11 @@ else fi {% endhighlight %} -In this example, that is just an extention of the previuous example, we evealuate a -variable i to 150. If i is gretaer or equal to 200, +In this example, that is just an extension of the previous example, we evaluate a +variable i to 150. If i is greater or equal to 200, you print out "You chose a big number", if i is equal to 150 you print out "You chose 150" otherwise you print out "You chose a small number". -Therefore the output of this piece of code is: +Therefore, the output of this piece of code is:
   You chose 150.
diff --git a/site/pages/scripts/while-loop.html b/site/pages/scripts/while-loop.html
index b42ba98..9a00602 100644
--- a/site/pages/scripts/while-loop.html
+++ b/site/pages/scripts/while-loop.html
@@ -41,10 +41,10 @@ done
 {% endhighlight %}
 
 In this first example, you simply create a variable called i and evaluate it to 0.
-Then you acces the while loop: the condition  [$i -lt 4]  means that this while
-loop will run until the  i  varibale is less than 4.
+Then you access the while loop: the condition  [$i -lt 4]  means that this while
+loop will run until the  i  variable is less than 4.
 Every cycle of this loop, you print out the value of variable i with  echo $i 
-and finally you increase its value by 1 with  i=$((i + 1)) .
+and finally, you increase its value by 1 with  i=$((i + 1)) .
 Therefore in 4 cycles the value of i will be 4. This will make the condition of the while loop false.
 The output of this piece of code is:
 
@@ -58,7 +58,7 @@ The output of this piece of code is:
 
 
 
-Sometimes it is required to decleare infinite loops for various programming purposes. 
+Sometimes it is required to declare infinite loops for various programming purposes.
Here is an example: {% highlight bash %} i=1; @@ -82,7 +82,7 @@ No termination condition is set for this loop in this example. This type of loop is called infinite loop.
The exit statement is used to quit the loop. This loop will iterate for 9 times, then -as soon as i becomes equal to 0, the condtition of the last if +as soon as i becomes equal to 0, the condition of the last if statement will evaluate to true and the loop will be terminated.
The output of this piece of code is: @@ -115,7 +115,7 @@ done In scripting, while loops are often used to process files line by line.
-Here is an examaple: +Here is an example: {% highlight bash %} while read -r first_name last_name phone; do @@ -125,12 +125,12 @@ done < "$file" The read command is used to read a file line by line. The flag -r is used to tell the -command read to intepret backslashes (/) literally, instead as escape characters. +command read to interpret backslashes (/) literally, instead as escape characters. This command, expect for some few rare cases, should always be used with this flag. In this example, < "$file" redirects the loop's input from a file whose name is stored in a variable. -This file has 3 colums, first_name last_name phone , separated by +This file has 3 columns, first_name last_name phone , separated by blank space (or a tab). This piece of code only prints out the second column.