More code review
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@238 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
d50eea6277
commit
95b6720f2e
21 changed files with 270 additions and 269 deletions
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
name: Marwan Announ
|
name: Announ Marwan
|
||||||
position: FileSystem team
|
position: FileSystem team
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
name: Alessandro Luini
|
name: Alessandro Luini
|
||||||
position: Intermediate commands team
|
position: Advanced commands team
|
||||||
---
|
---
|
||||||
|
|
|
@ -6,28 +6,33 @@ category-title: Advanced commands
|
||||||
tags: remove column
|
tags: remove column
|
||||||
title: colrm
|
title: colrm
|
||||||
---
|
---
|
||||||
The <code>colrm</code> is a command that removes the column that you indicate <br>
|
The <code>colrm</code> is a command that removes the column that you indicate <br>
|
||||||
|
|
||||||
Here we have a file named <code>example.txt</code> that contains two lines to test this command:<br>
|
Here we have a file named <code>example.txt</code> that contains two lines to test this command:<br>
|
||||||
|
|
||||||
<code>example.txt</code>
|
|
||||||
{% highlight bash linenos %}
|
{% highlight bash linenos %}
|
||||||
123456789
|
123456789
|
||||||
abcdefghi
|
abcdefghi
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
The syntax command is:
|
The syntax command is:
|
||||||
<pre> colrm [first] [last]</pre>
|
<pre>
|
||||||
|
colrm [first] [last]
|
||||||
|
</pre>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
colrm 4 < example.txt
|
colrm 4 < example.txt
|
||||||
123
|
123
|
||||||
abc
|
abc
|
||||||
</pre>
|
</pre>
|
||||||
<p>How you can see, if I don't indicate the last column, the command removes all the colums starting from 4 included. </p>
|
|
||||||
|
How you can see, if I don't indicate the last column, the command removes
|
||||||
|
all the colums starting from 4 included.
|
||||||
<pre>
|
<pre>
|
||||||
colrm 2 4 < example.txt
|
colrm 2 4 < example.txt
|
||||||
156789
|
156789
|
||||||
aefghi
|
aefghi
|
||||||
</pre>
|
</pre>
|
||||||
<p>Here, how you can see, the command has removed not all the columns, but only the colums that starting at 2 and ending at 4, included. </p>
|
|
||||||
|
Here, how you can see, the command has removed not all the columns, but only the colums that
|
||||||
|
starting at 2 and ending at 4, included.
|
||||||
|
|
|
@ -6,7 +6,8 @@ category-title: Advanced commands
|
||||||
tags: compare sorted files
|
tags: compare sorted files
|
||||||
title: comm
|
title: comm
|
||||||
---
|
---
|
||||||
The <code>comm</code> is a command that compares two sorted files line by line and writes the output: the lines that are in common and the lines that are unique. <br>
|
The <code>comm</code> is a command that compares two sorted files
|
||||||
|
line by line and writes the output: the lines that are in common and the lines that are unique.<br>
|
||||||
|
|
||||||
Here we have two files named <code>example1.txt</code> and
|
Here we have two files named <code>example1.txt</code> and
|
||||||
<code>example2.txt</code> that contain 5 elements, to test this command:<br>
|
<code>example2.txt</code> that contain 5 elements, to test this command:<br>
|
||||||
|
@ -30,28 +31,31 @@ Pizza
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
The syntax command is:
|
The syntax command is:
|
||||||
<pre>comm [flag][file1] [file2]</pre>
|
<pre>
|
||||||
|
comm [flag][file1] [file2]
|
||||||
|
</pre>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
comm example1.txt example2.txt
|
comm example1.txt example2.txt
|
||||||
Icecream
|
Icecream
|
||||||
Chocolate
|
Chocolate
|
||||||
Cake
|
Cake
|
||||||
Tomato
|
Tomato
|
||||||
Candy
|
Candy
|
||||||
Biscuit
|
Biscuit
|
||||||
Pizza
|
Pizza
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>The elements of the first file doesn't have the tab.</p>
|
<ul>
|
||||||
<p>The elements of the second file have one tab.</p>
|
<li>The elements of the first file have less indentation.</li>
|
||||||
<p>The elements in common have two tabs.</p>
|
<li>The elements of the second file have some more indentation.</li>
|
||||||
|
<li>The elements in common have even more indentation than those of the second file.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h2>Flags</h2>
|
<h3>Flags</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li> <b>-1</b>: supress column 1</li>
|
<li> <b>-1</b>: supress column 1</li>
|
||||||
<li> <b>-2</b>: supress column 2</li>
|
<li> <b>-2</b>: supress column 2</li>
|
||||||
<li> <b>-3</b>: supress column 3</li>
|
<li> <b>-3</b>: supress column 3</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -46,13 +46,13 @@ and the output will be:
|
||||||
<pre>
|
<pre>
|
||||||
2,4c2,4
|
2,4c2,4
|
||||||
|
|
||||||
< I need to run the laundry.
|
< I need to run the laundry.
|
||||||
< I need to wash the dog.
|
< I need to wash the dog.
|
||||||
< I need to get the car detailed.
|
< I need to get the car detailed.
|
||||||
---
|
---
|
||||||
> I need to do the laundry.
|
> I need to do the laundry.
|
||||||
> I need to wash the car.
|
> I need to wash the car.
|
||||||
> I need to get the dog detailed.
|
> I need to get the dog detailed.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
In our output, "2,4c2,4" means: "Lines 2 through 4 in the first
|
In our output, "2,4c2,4" means: "Lines 2 through 4 in the first
|
||||||
|
|
|
@ -16,18 +16,32 @@ Use chgrp [:group] file to create a group for a file <br>
|
||||||
Use Sudo chown owner[:group], if you need root permission for add the user to the group </p>
|
Use Sudo chown owner[:group], if you need root permission for add the user to the group </p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
chown Joy [students] file
|
chown user [group] file1 file2 ...
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>-f</code> Don't show all error messages except usage messages.</li>
|
<li><b>-f</b> Don't show all error messages except usage messages.</li>
|
||||||
<li><code>-h</code> Changes the symbolic link and not the file or directory referred by the symbolic link.</li>
|
<li><b>-h</b> Changes the symbolic link and not the file or directory referred
|
||||||
<li><code>-R</code> changing the ownership for each file in a folder, if encounter symbolic link it will cheange the owenership of that symbolic link,
|
by the symbolic link.
|
||||||
and the directoryfile referred in the symbolic link, but the directory is not further transversed. </li>
|
</li>
|
||||||
<li><code>-RH</code> changing the ownership for each file in a folder, if encounter symbolic link it will cheange the owenership of that symbolic link,
|
<li><b>-R</b> changing the ownership for each file in a folder, if it encounters
|
||||||
the directory/file referred in the symbolic link, and all the directory is further transversed.</li>
|
a symbolic link it will cheange the owenership of that symbolic link,
|
||||||
<li><code>-RL</code> <!-- don't understand the diffrence between -RH --> If the -R option is specified and a symbolic link referencing a file of type directory
|
and the directoryfile referred in the symbolic link, but the directory is not
|
||||||
is specified on the command line or encountered during the traversal of a file hierarchy, the chown command shall change the user ID (and group ID, if specified) of the directory referenced by the symbolic link and all files in the file hierarchy below it.</li>
|
further transversed.
|
||||||
<li><code>-RP</code> changing the ownership for each file in a folder, if encounter symbolic link it will cheange the owenership of that symbolic link, but will not chenage the
|
</li>
|
||||||
the directory/file referred in the symbolic link, and the directory is not further transversed.</li>
|
<li><b>-RH</b> changing the ownership for each file in a folder, if encounter symbolic link
|
||||||
|
it will change the owenership of that symbolic link,
|
||||||
|
the directory/file referred in the symbolic link, and all the
|
||||||
|
directory is further transversed.
|
||||||
|
</li>
|
||||||
|
<li><b>-RL</b> If the -R option is specified and a symbolic link referencing a file of type directory
|
||||||
|
is specified on the command line or encountered during the traversal of a file hierarchy,
|
||||||
|
the chown command shall change the user ID (and group ID, if specified) of the directory
|
||||||
|
referenced by the symbolic link and all files in the file hierarchy below it.
|
||||||
|
</li>
|
||||||
|
<li><b>-RP</b> changing the ownership for each file in a folder, if encounter symbolic
|
||||||
|
link it will cheange the owenership of that symbolic link, but will not chenage the
|
||||||
|
the directory/file referred in the symbolic link, and the directory is not
|
||||||
|
further transversed.
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
layout: page
|
|
||||||
category-page: basic
|
|
||||||
category-title: Basic commands
|
|
||||||
author: Joy Albertini
|
|
||||||
tags: directory current path pwd
|
|
||||||
title: pdw
|
|
||||||
---
|
|
||||||
|
|
||||||
<p>The <code>pwd</code> command (path of working directory) <br>
|
|
||||||
The absolute pathname of the current working directory is given as result.</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
cd /home/user
|
|
||||||
pwd = /home/user
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><code>-P </code> Show the working directory path without symbolic link (links to folder) <br>
|
|
||||||
Example: <code>PWD</code> /home/symphoto, symphotos is a symlink to /home/photos <code>PDW-P</code> will show /home/photos</li>
|
|
||||||
<li><code>-L </code> Show the working directory logical path with symbolic link. <br>
|
|
||||||
Example: There is a symbolic link /home/symphoto, that redirect to /home/photo, <code>PWD -L</code> will show /home/symphoto</li>
|
|
||||||
<li> Without flag, the -L is assumed, so the normal PWD is in reality PDW-L</li>
|
|
||||||
</ul>
|
|
|
@ -7,14 +7,17 @@ tags: search tag apropos keyword
|
||||||
title: apropos
|
title: apropos
|
||||||
---
|
---
|
||||||
|
|
||||||
<p>The <code>apropos</code>
|
The <code>apropos</code> command is used to search command in the shell with a keyword,
|
||||||
Apropos is a command to search command in the shell with a keyword, it will output all command related to the keyword <br>
|
it will output all command related to the keyword <br>
|
||||||
Example with the command <code>apropos archive</code>, the shell will output tar, zip ecc... </p>
|
|
||||||
|
Example with the command <code>apropos archive</code>, the shell will output tar, zip ecc...<br>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
apropos [-flag] keyword
|
apropos [flags] keyword
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<h3>Flags</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>-V</code> (version) print version of the comnmand<br></li>
|
<li><code>-V</code> (version) print version of the comnmand<br></li>
|
||||||
<li><code>-h</code> Help message how to use apropos</li>
|
<li><code>-h</code> Help message how to use apropos</li>
|
||||||
|
|
|
@ -4,10 +4,11 @@ category-page: intermediate
|
||||||
category-title: Intermediate commands
|
category-title: Intermediate commands
|
||||||
tags: base64 representation
|
tags: base64 representation
|
||||||
author: Gianmarco De Vita
|
author: Gianmarco De Vita
|
||||||
title: Base64
|
title: base64
|
||||||
previous-page:
|
previous-page:
|
||||||
next-page:
|
next-page:
|
||||||
---
|
---
|
||||||
|
|
||||||
<i>Base64</i> is an encoding system that allows the translation of binary
|
<i>Base64</i> is an encoding system that allows the translation of binary
|
||||||
data into ASCII text strings, basing upon 64 different ASCII characters.<br>
|
data into ASCII text strings, basing upon 64 different ASCII characters.<br>
|
||||||
Each <i>Base64</i> digit represents exactly 6 bits of data so, for example,
|
Each <i>Base64</i> digit represents exactly 6 bits of data so, for example,
|
||||||
|
|
|
@ -24,7 +24,7 @@ the pathname and the suffix, if indicated, will be also deleted.<br><br>
|
||||||
Here are some of the most common basename flags:
|
Here are some of the most common basename flags:
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li> <b>-a</b>: Every aregument is treated as a string </li>
|
<li><b>-a</b>: Every aregument is treated as a string </li>
|
||||||
<li> <b>-s</b>: The suffix is taken as its argument </li>
|
<li><b>-s</b>: The suffix is taken as its argument </li>
|
||||||
<li> <b>-a</b>: Supports multiple arguments and they will be treated as a name </li>
|
<li><b>-a</b>: Supports multiple arguments and they will be treated as a name </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -7,30 +7,32 @@ author: Marco Farace
|
||||||
title: bash
|
title: bash
|
||||||
---
|
---
|
||||||
|
|
||||||
<p>Bash is an sh-compatible command language interpreter that executes commands
|
Bash is an sh-compatible command language interpreter that executes commands
|
||||||
read from the standard input or from a file. Bash also incorporates useful
|
read from the standard input or from a file. Bash also incorporates useful
|
||||||
features from the Korn and C shells (ksh and csh). Bash is intended to be a
|
features from the Korn and C shells (ksh and csh).<br>
|
||||||
conformant implementation of the Shell and Utilities portion of the IEEE POSIX
|
|
||||||
specification (IEEE Standard 1003.1).</p>
|
|
||||||
|
|
||||||
<h3> Flags </h3>
|
<h3>Flags</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>-c: If this option is present, then commands are read from
|
<li>-c: If this option is present, then commands are read from
|
||||||
string. If there are arguments after the string, they are
|
string. If there are arguments after the string, they are
|
||||||
assigned to the positional parameters, starting with $0.</li>
|
assigned to the positional parameters, starting with $0.
|
||||||
<li>-i: If this option is present, the shell is interactive.</li>
|
</li>
|
||||||
<li>-l: Make bash act as if it had been invoked as a login shell</li>
|
<li>-i: If this option is present, the shell is interactive.</li>
|
||||||
<li>-r: If this option is present, the shell becomes restricted</li>
|
<li>-l: Make bash act as if it had been invoked as a login shell.</li>
|
||||||
<li>-s: If this option is present, or if no arguments remain after
|
<li>-r: If this option is present, the shell becomes restricted.</li>
|
||||||
option processing, then commands are read from the standard
|
<li>-s: If this option is present, or if no arguments remain after
|
||||||
input. This option allows the positional parameters to be
|
option processing, then commands are read from the standard
|
||||||
set when invoking an interactive shell.</li>
|
input. This option allows the positional parameters to be
|
||||||
<li>-s: List only the name, line and time fields. This is the default.</li>
|
set when invoking an interactive shell.
|
||||||
<li>-T: Print a character after the user name indicating the state of the
|
</li>
|
||||||
terminal line: `+' if the terminal is writable; `-' if it is not;
|
<li>-s: List only the name, line and time fields. This is the default.</li>
|
||||||
and `?' if a bad line is encountered.</li>
|
<li>-T: Print a character after the user name indicating the state of the
|
||||||
<li>-u: Print the idle time for each user, and the associated process ID.</li>
|
terminal line: `+' if the terminal is writable; `-' if it is not;
|
||||||
<li>am I: Returns the invoker's real user name.</li>
|
and `?' if a bad line is encountered.
|
||||||
<li>file: By default, who gathers information from the file /var/run/utmpx.
|
</li>
|
||||||
An alternative file may be specified.</li>
|
<li>-u: Print the idle time for each user, and the associated process ID.</li>
|
||||||
</ul>
|
<li>am I: Returns the invoker's real user name.</li>
|
||||||
|
<li>file: By default, who gathers information from the file /var/run/utmpx.
|
||||||
|
An alternative file may be specified.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
|
@ -10,7 +10,7 @@ The <code>cat</code> command can be easily associated to the word “concatenati
|
||||||
it doesn’t have that only function: in fact, cat command gives us the possibility to create
|
it doesn’t have that only function: in fact, cat command gives us the possibility to create
|
||||||
files and also to display them.<br>
|
files and also to display them.<br>
|
||||||
|
|
||||||
The name stands for <i>catenate</i>.<br><br>
|
The name stands for <i>catenate</i>.<br>
|
||||||
|
|
||||||
<h3>Usage</h3>
|
<h3>Usage</h3>
|
||||||
|
|
||||||
|
|
|
@ -6,51 +6,44 @@ tags: versioning commit merge software source code
|
||||||
author: Andrea Brites Marto
|
author: Andrea Brites Marto
|
||||||
title: git
|
title: git
|
||||||
---
|
---
|
||||||
If you want to use <i>Git</i> on the shell you need to know how this command works (usually it is preinstalled on Mac and Linux).<br>
|
If you want to use <i>Git</i> on the shell you need to know how this command works.<br>
|
||||||
The <i>git</i> command providesa set of high-level operations and full access to internals.
|
The <i>git</i> command providesa set of high-level operations and full access to internals.<br>
|
||||||
|
|
||||||
Here is the basic syntax but sometimes you will may have some more complicated:
|
Here is the basic syntax but commands may become some more complicated:
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
git [flags] [path]
|
git [flags] [path]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
First of all, you need to know if you have the right version of git with:
|
<h3>Start a working environment</h3>
|
||||||
|
|
||||||
<pre>
|
|
||||||
git --version
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
Now that we know that we have the right version, we can move to the common <code>git</code> flags used.
|
|
||||||
I will divide commands in different type of operation.<br>
|
|
||||||
|
|
||||||
<h3>Start a working area</h3>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>clone: is used to clone a repository in a new directory.</li>
|
<li><b>clone</b>: is used to clone a repository in a new directory.</li>
|
||||||
<li>init: this onw is used to create an empty Git repository or reinitialize an existing one.</li>
|
<li><b>init</b>: this onw is used to create an empty Git repository or reinitialize
|
||||||
|
an existing one.
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Work on the current changes</h3>
|
<h3>Work on the current changes</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>add: add a file contents to the index.</li>
|
<li><b>add</b>: add a file contents to the index.</li>
|
||||||
<li>mv: move or renamea file, directory or a symlink (a symbolic link).</li>
|
<li><b>mv</b>: move or renamea file, directory or a symlink (a symbolic link).</li>
|
||||||
<li>rm: remove files from the working tree and from the index.</li>
|
<li><b>rm</b>: remove files from the working tree and from the index.</li>
|
||||||
<li>format-patch id(commit): create a file patch</li>
|
<li><b>format-patch id</b>: create a file patch</li>
|
||||||
<li>am: apply a patch file</li>
|
<li><b>am</b>: apply a patch file</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>History and state</h3>
|
<h3>History and state</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>log: show commit logs.</li>
|
<li><b>log</b>: show commit logs.</li>
|
||||||
<li>status: show the working tree status.</li>
|
<li><b>status</b>: show the working tree status.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Managing modification</h3>
|
<h3>Managing modification</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>commit: record changes to the repository.</li>
|
<li><b>commit</b>: record changes to the repository.</li>
|
||||||
<li>diff: show changes between commits.</li>
|
<li><b>diff</b>: show changes between commits.</li>
|
||||||
<li>merge: merge two or more development histories together.</li>
|
<li><b>merge</b>: merge two or more development histories together.</li>
|
||||||
<li>pull: fetch from and update your local directory with the repository.</li>
|
<li><b>pull</b>: fetch from and update your local directory with the repository.</li>
|
||||||
<li>push: update the remote repository with your changes.</li>
|
<li><b>push</b>: update the remote repository with your changes.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -7,92 +7,91 @@ tags: server ping latency UNIX
|
||||||
title: ping
|
title: ping
|
||||||
---
|
---
|
||||||
|
|
||||||
<p>
|
The <code>ping</code> command, is used to test connection between a <b>local server/computer</b>
|
||||||
The <code>ping</code> command, is used to test connection between a <b>local server/computer</b> to a <b>remote UNIX server</b>.
|
to a <b>remote UNIX server</b>.<br>
|
||||||
The ping command sends <b>ICMP Echo Request packets</b> to the remote server for accessing it.
|
The ping command sends <b>ICMP Echo Request packets</b> to the remote server for accessing it.
|
||||||
Each <b>packet echoed back </b> (via an ICMP Echo Response packet) is written to the shell output.
|
Each <b>packet echoed back </b> (via an ICMP Echo Response packet) is written to the shell output.
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Usage:
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li> test remote server if working. </li>
|
|
||||||
<li> test network connectivity from your local machine to server </li>
|
|
||||||
<li> general network problems </li>
|
|
||||||
<ul>
|
|
||||||
|
|
||||||
<p>Example:
|
|
||||||
<ul>
|
|
||||||
<li> ping IP address = <code>ping 192.168.3.2</code></li>
|
|
||||||
<li> ping Server_name = <code>ping yahoo.com</code></li>
|
|
||||||
<ul>
|
|
||||||
The shell will output something like this: <b>64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms </b>for each packets that return (echoed back).
|
|
||||||
To stop the ping command press <code>control + c</code> </p>
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
ping [-flag] server
|
ping [-flag] server
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
The main usages for the <code>ping</code> command are:
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>Test whether remote server if working.</li>
|
||||||
|
<li>Check the network connectivity from your local machine to a remote one.</li>
|
||||||
|
<li>Check for general network issues.</li>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
ping theshell.ch
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The shell will output something like this:
|
||||||
|
<i>64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms </i>for each packets
|
||||||
|
that returns (echoed back).<br>
|
||||||
|
|
||||||
|
To stop the ping command press <code>control + c</code>.
|
||||||
|
|
||||||
|
<h3>Flags</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>-c</code> send limited number of packets with ping -c (nr of packets) <br>
|
<li><b>-c</b>: send limited number of packets with ping -c (nr of packets)<br>
|
||||||
Example: ping -c 4 yahoo.com, the shell will display the first 4 packets returned, and then stop. </li> <br>
|
Example: ping -c 4 yahoo.com, the shell will display the first 4 packets returned,
|
||||||
|
and then stop.
|
||||||
<li><code>-n</code> avoid dns lookup, avoid to lookup symbolic names for host addresses, so only numeric output <br>
|
</li>
|
||||||
Example: ping -n yahoo.com </li> <br>
|
<li><b>-n</b>: avoid dns lookup, avoid to lookup symbolic names for host addresses,
|
||||||
|
so only numeric output.
|
||||||
<li><code>-a</code> get an audio warning, when the remote server comes online <br>
|
</li>
|
||||||
Example: ping -a yahoo.com, server comes online audio signal for every packets that returns</li><br>
|
<li><b>-a</b>: get an audio warning, when the remote server comes online <br>
|
||||||
|
Example: ping -a yahoo.com, server comes online audio signal for every
|
||||||
<li><code>-b</code> Allow pinging a broadcast address (broadcast network, is a network with many devices on it).<br></li> <br>
|
packets that returns.
|
||||||
|
</li>
|
||||||
<li><code>-m</code> (mark) tag the packets going out </li> <br>
|
<li><b>-b</b>: Allow pinging a broadcast address (broadcast network, is a network
|
||||||
|
with many devices on it).
|
||||||
<li><code>-f</code> (Flood ping) For every ECHO_REQUEST sent (.) is printed,
|
</li>
|
||||||
for every ECHO_REPLY received, a backspace is printed.
|
<li><b>-m</b>: (mark) tag the packets going out.</li>
|
||||||
With this command you can easily understand how many packets are being dropped.</li> <br>
|
<li><b>-f</b>: (Flood ping) For every ECHO_REQUEST sent (.) is printed,
|
||||||
|
for every ECHO_REPLY received, a backspace is printed.
|
||||||
<li><code>-i</code> (interval) set the interval between seending each packet (defaultn 1 second); only super-user can set interval values
|
With this command you can easily understand how many packets are being dropped.
|
||||||
less than 0.2 seconds <br>
|
</li>
|
||||||
Example: ping -i 5 yahoo.com; the pacjets will be send each 5 seconds instead of 1</li> <br>
|
<li><b>-i</b>: (interval) set the interval between seending each packet (default 1 second);
|
||||||
|
only super-user can set interval values less than 0.2 seconds.
|
||||||
<li><code>-I</code> (interface-address) set souce adress to a specific interface adress,
|
</li>
|
||||||
example the name of the device or IP. When pinging local adresses IPV6, is a needed flag </li> <br>
|
<li><b>-I</b>: (interface-address) set souce adress to a specific interface adress,
|
||||||
|
example the name of the device or IP. When pinging local adresses IPV6, is a needed flag.
|
||||||
<li><code>-l</code> (preload) ping send packets but don't wait for reply.(you need sudo = amministrator persmissions) <br>
|
</li>
|
||||||
Example: Sudo ping -l 2 yahoo.com; it will send 2 packtes without waiting for the server reply.</li> <br>
|
<li><b>-l</b>: (preload) ping send packets but don't wait for reply.
|
||||||
|
Admin permissions are required to use this flag.
|
||||||
<li><code>-L</code> Remove loopback of multicast packets </li> <br>
|
</li>
|
||||||
|
<li><b>-L</b>: Remove loopback of multicast packets.</li>
|
||||||
<li><code>-N</code> (Nioption) send ICMpv6 request, instead of Echo requests
|
<li><b>-N</b>: (Nioption) send ICMpv6 request, instead of Echo requests
|
||||||
<ul>
|
<ul>
|
||||||
<li> <code>ipv6</code> request Ipv6 adresses </li>
|
<li><b>ipv6</b>: request Ipv6 adresses.</li>
|
||||||
<li> <code>ipv4-all</code> request Ipv4 adresses </li>
|
<li><b>ipv4-all</b>: request Ipv4 adresses.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li> <br>
|
</li>
|
||||||
|
<li><b>-p</b>: (pattern) specify up to 16 number to fill out the packets sent.</li>
|
||||||
<li><code>-p</code> (pattern) specify up to 16 number to fill out the packets you send <br>
|
<li><b>-D</b>: print timestamp (unix time + microseconds) in each line.</li>
|
||||||
Example: ping -p ff, al packet will be fill with ones, ff = 255 in hexadicimal, 11111111 in binary. </li> <br>
|
<li><b>-q</b>: (Quiet output) Nothing displayed except the summary lines at the start
|
||||||
|
and at the end.
|
||||||
<li><code>-D</code> print timestamp (unix time + microseconds) in each line<br>
|
</li>
|
||||||
Example: ping -D yahoo.com; the shell will output 64 bytes from 72.30.35.10: icmp_seq=1 ttl=51 time=137.882 ms. </li> <br>
|
<li><b>-R</b>: (Record route), displays the route buffer on the packets that include
|
||||||
|
RECORD_ROUTE in the ECHO_REQUEST.
|
||||||
<li><code>-q</code> (Quiet output) Nothing displayed except the summary lines at the start and at the end.
|
</li>
|
||||||
Example: ping -q yahoo.com, shell Output initially PING yahoo.com (72.30.35.10): 56 data bytes, and nothig else
|
<li><b>-r</b>: bypass the normal routing in a directly-attached network.</li>
|
||||||
until you stop the ping command, and the shell will display the stats. </li> <br>
|
<li><b>-s</b>: (packetsize) Specifies the data bytes to send (default is 56 that
|
||||||
|
+ 8 byte of ICMP = 64 ICMP data bytes).
|
||||||
<li><code>-R</code> (Record route), displays the route buffer on the packets that include RECORD_ROUTE in the ECHO_REQUEST.</li> <br>
|
</li>
|
||||||
<li><code>-r</code> bypass the normal routing in a directly-attached network </li> <br>
|
<li><b>-t</b>: set IP time-to-live (set how long execute ping in seconds).</li>
|
||||||
|
<li><b>-U</b>: print full user-to-user latency (legacy ping behaviour).</li>
|
||||||
<li><code>-s</code> (packetsize) Specifies the data bytes to send (default is 56 that + 8 byte of ICMP = 64 ICMP data bytes) <br>
|
<li><b>-v</b>: output verbose on output</li>
|
||||||
Example: ping -s 33 yahoo.com; send packets of 33 + 8 ICMP = 41 bytes to yahoo.com. </li> <br>
|
<li><b>-V</b>: Display verion of command</li>
|
||||||
|
<li><b>-w</b>: (deadline) Timeout in seconds of ping command, regardless of how\
|
||||||
<li><code>-t</code> set IP time-to-live (set how long execute ping in seconds) <br>
|
many packets have been sent.
|
||||||
Example: ping -t 3: the shell will ping yahoo.com for 3 seconds, and then stops.</li> <br>
|
</li>
|
||||||
|
<li><b>-W</b>: (timeout), time waiting for a response from the server, if the server
|
||||||
<li><code>-U</code> print full user-to-user latency (legacy ping behaviour).</li> <br>
|
dosen't reply in the time set, the ping command will stop.
|
||||||
<li><code>-v</code> output verbose on output </li> <br>
|
</li>
|
||||||
<li><code>-V</code> Display verion of command </li> <br>
|
|
||||||
<li><code>-w</code> (deadline) Timeout in seconds of ping command, regardless of how many packets have been sent. </li> <br>
|
|
||||||
<li><code>-W</code> (timeout), time waiting for a response from the server, if the server dosen't reply in the time set, the ping command will stop. </li> <br>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,7 +4,7 @@ category-page: intermediate
|
||||||
category-title: Intermediate commands
|
category-title: Intermediate commands
|
||||||
tags: strings read binaries file
|
tags: strings read binaries file
|
||||||
author: Marco Farace
|
author: Marco Farace
|
||||||
title: Strings
|
title: strings
|
||||||
---
|
---
|
||||||
|
|
||||||
The strings command returns each string of printable characters (ASCII)
|
The strings command returns each string of printable characters (ASCII)
|
||||||
|
|
|
@ -3,7 +3,7 @@ layout: page
|
||||||
category-page: fs
|
category-page: fs
|
||||||
category-title: FileSystem
|
category-title: FileSystem
|
||||||
tags: absolute relative path
|
tags: absolute relative path
|
||||||
author: Marwan Announ
|
author: Announ Marwan
|
||||||
title: Absolute paths
|
title: Absolute paths
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -7,26 +7,30 @@ author: Mirko Ponzio
|
||||||
title: pwd
|
title: pwd
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<!-- Co-authored with Joy Albertini -->
|
||||||
|
|
||||||
The command <code>pwd</code>(abbreviation of print working directory, it returns the
|
The command <code>pwd</code>(abbreviation of print working directory, it returns the
|
||||||
corrent directory) it is a command of the operation system Unix and Unix-like,
|
corrent directory) it is a command, that show the absolute pathname on the corrent directory.<br>
|
||||||
and in general of the systems POSIX, that show on the standard output the
|
|
||||||
absolute pathname on the corrent directory.<br>
|
|
||||||
Since a command line interface cannot provide graphic pictures of the file
|
|
||||||
system structure, it must have a different way of representing it.<br>
|
|
||||||
Think of the file system tree as a maze, and you are standing in it. At any
|
|
||||||
given moment, you are located in a single directory.<br>
|
|
||||||
Inside that directory, you can see its files and the pathway to its parent
|
|
||||||
directory and the pathways to the subdirectories of the directory in which you
|
|
||||||
are standing.<br>
|
|
||||||
|
|
||||||
The working directory is the directory where you are standing in. So for
|
The working directory is the directory where you are standing in. So for
|
||||||
knowing where you are, you must use the pwd command.<br><br>
|
knowing where you are, you can use the pwd command.<br>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
cd /home/user
|
||||||
|
pwd = /home/user
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Flags</h3>
|
<h3>Flags</h3>
|
||||||
<ul>
|
|
||||||
<li> <b>-L</b>: Display the logical current working directory.</li>
|
|
||||||
<li> <b>-P</b>: Display the physical current working directory (all symbolic links resolved).</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
If no options are specified, the -L option is assumed.
|
<ul>
|
||||||
|
<li><code>-P </code> Show the working directory path without symbolic link (links to
|
||||||
|
folder).<br>
|
||||||
|
Example: <i>/home/symphoto</i> a symlink to <i>/home/photos</i> <code>pwd -P</code>
|
||||||
|
will display <i>/home/photos</i>.
|
||||||
|
</li>
|
||||||
|
<li><code>-L </code> Show the working directory logical path with symbolic link.<br>
|
||||||
|
Example: <i>/home/symphoto</i>, that redirect to <i>/home/photos</i>,
|
||||||
|
<code>pwd -L</code> will show <i>/home/symphoto</i>.
|
||||||
|
</li>
|
||||||
|
<li>Without any flag, -L is assumed, so the normal pwd is in reality <code>pwd -L</code>.</li>
|
||||||
|
</ul>
|
||||||
|
|
|
@ -3,7 +3,7 @@ layout: page
|
||||||
category-page: fs
|
category-page: fs
|
||||||
category-title: FileSystem
|
category-title: FileSystem
|
||||||
tags: absolute relative path
|
tags: absolute relative path
|
||||||
author: Marwan Announ
|
author: Announ Marwan
|
||||||
title: Relative paths
|
title: Relative paths
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,14 @@ Well, Unix Shell is actually a must have skill for any well respectable computer
|
||||||
There are indeed several reasons to learn using it, here are some:
|
There are indeed several reasons to learn using it, here are some:
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li> It is the only way to communicate with servers, because they don’t have a graphical user interface. </li>
|
<li>It is the only way to communicate with servers, because they don’t have a graphical
|
||||||
<li> You can program in the Shell! Unix Shell provides a set of special commands that can be used to create Scripts.
|
user interface.
|
||||||
Scripts are programs that can execute in a loop a series of commands. You can even create scripts that automatically fix your code!</li>
|
</li>
|
||||||
<li> You look like a hacker, when you use it! (If you really want to look like a pro, go to settings and make
|
<li>You can program in the Shell! Unix Shell provides a set of special commands that can
|
||||||
the shell background black, with green text.) </li>
|
be used to create Scripts. Scripts are programs that can execute in a loop a series of
|
||||||
|
commands. You can even create scripts that automatically fix your code!
|
||||||
|
</li>
|
||||||
|
<li>You look like a hacker, when you use it! (If you really want to look like a pro,
|
||||||
|
go to settings and make the shell background black, with green text).
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -6,54 +6,49 @@ tags: command base echo cat grep
|
||||||
author: Dario Rasic
|
author: Dario Rasic
|
||||||
title: Script Base Commands
|
title: Script Base Commands
|
||||||
---
|
---
|
||||||
<br>
|
<!-- Echo command text -->
|
||||||
<!-- Echo command text -->
|
|
||||||
<h3>Echo</h3>
|
<h3>Echo</h3>
|
||||||
<p>This command print as output its entire argument on the command-line.<br>
|
<p>This command print as output its entire argument on the command-line.<br>
|
||||||
It could be used with variables, like in the following example:<br>
|
It could be used with variables, like in the following example:<br>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
example:"this is an example"
|
example="this is an example"
|
||||||
<br>
|
|
||||||
<b>echo</b> $example<br>
|
echo $example
|
||||||
this is an example
|
this is an example
|
||||||
</pre>
|
</pre>
|
||||||
<br>
|
|
||||||
|
|
||||||
|
<!-- Cat command text -->
|
||||||
<!-- Cat command text -->
|
|
||||||
<h3>Cat</h3>
|
<h3>Cat</h3>
|
||||||
|
|
||||||
This command prints the content of a certain file as an output on the command-line.<br>
|
This command prints the content of a certain file as an output on the
|
||||||
|
command-line.<br>
|
||||||
|
|
||||||
|
As example, we could imagine a simple text file in nano named "Hello", which contains
|
||||||
|
the line "Hello World".<br>
|
||||||
|
So, our command example will look like this:<br>
|
||||||
|
|
||||||
As example, we could imagine a simple text file in pages named "Hello", which contains the line "Hello World".<br>
|
|
||||||
So, our command example will look like this:<br>
|
|
||||||
<pre>
|
<pre>
|
||||||
pages Hello
|
nano Hello
|
||||||
<b>cat</b> Hello<br>
|
cat Hello
|
||||||
Hello World
|
Hello World
|
||||||
</pre>
|
</pre>
|
||||||
<br>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Grep command text -->
|
<!-- Grep command text -->
|
||||||
<h3>Grep</h3>
|
<h3>Grep</h3>
|
||||||
|
|
||||||
This one behaves very similarly to the previus one, but in this case it prints only the lines matching a certain pattern.<br>
|
This one behaves very similarly to the previus one, but in this case it prints only
|
||||||
In this we could imagine a certain text file "animals", which contains a list of animal-names.
|
the lines matching a certain pattern.<br>
|
||||||
|
In this we could imagine a certain text file "animals", which contains a list of animal-names.
|
||||||
|
|
||||||
If we want to select only the animals whose name begins with the letter "d", we will write this:<br>
|
If we want to select only the animals whose name begins with the letter "d", we will write this:<br>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
grep d animals<br>
|
grep "D" animals
|
||||||
Deer<br>
|
Deer
|
||||||
Dog<br>
|
Dragon
|
||||||
Dolphin<br>
|
Dinosaur
|
||||||
...
|
Dog
|
||||||
|
Dolphin
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
Loading…
Reference in a new issue