Team Basic: Adding openshell and commands man, open, say
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@73 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
177a24c87d
commit
d2d1d75763
4 changed files with 231 additions and 0 deletions
site/pages/cmd/basic
34
site/pages/cmd/basic/man.html
Normal file
34
site/pages/cmd/basic/man.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
layout: page
|
||||
category_title: Basic commands
|
||||
category-page: basic
|
||||
tags: manual
|
||||
author: De Vita Gianmarco
|
||||
title: man
|
||||
---
|
||||
<p>The <code>man</code> tool allows you to explore the various utilities
|
||||
of the Shell. To search for more information about a command, just write</p>
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ man command-name
|
||||
</pre>
|
||||
|
||||
<p>As result, a new session will be opened with information about the command
|
||||
you have typed (and more specifically about its functions and flags).</p>
|
||||
|
||||
<p>Using some flags, you can obtain with this command the same results you get
|
||||
when you use other commands. For istance:</p>
|
||||
|
||||
<h3>The <code>-k</code> flag</h3>
|
||||
<p>Using the <code>-k</code> flag, you obtain an equivalent result to
|
||||
<code>apropos</code>.</p>
|
||||
<pre>
|
||||
Device-name:Current-position username$ man -k command-name
|
||||
</pre>
|
||||
|
||||
<h3>The <code>-f</code> flag</h3>
|
||||
<p>Using the <code>-f</code> flag, you obtain an equivalent result to
|
||||
<code>whatis</code>.</p>
|
||||
<pre>
|
||||
Device-name:Current-position username$ man -f command-name
|
||||
</pre>
|
76
site/pages/cmd/basic/open.html
Normal file
76
site/pages/cmd/basic/open.html
Normal file
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
layout: page
|
||||
author: De Vita Gianmarco
|
||||
title: OPEN
|
||||
---
|
||||
<p>You can open files and folder as new windows through the terminal.
|
||||
The command is <code>open</code>. By writing the command open followed by the
|
||||
path and the name of the file (remember that you can omit the path if
|
||||
the file is in the current position), a new window in the common user
|
||||
interface opens. Now you can work on the opened file.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ open path/name-file
|
||||
</pre>
|
||||
|
||||
<h3>Open a file with a specific application</h3>
|
||||
<p>Adding the flag <code>-a</code> to the command permit you to decide with
|
||||
which specific application open the file. Just write the flag followed by the
|
||||
name of the application.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ open -a application-name path/name-file
|
||||
</pre>
|
||||
|
||||
<h4>Example</h4>
|
||||
<p>Assume that I want to open with <i>Preview</i> the file
|
||||
<code>abc.pdf</code> on my Desktop.
|
||||
I have to write:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
User-Device:~ user$ open -a preview Desktop/abc.pdf
|
||||
</pre>
|
||||
|
||||
<p>As result, a new <i>Preview</i> window appears in pop up showing the content of the
|
||||
chosen file.
|
||||
</p>
|
||||
|
||||
<h3>Open a file with <i>TextEdit</i></h3>
|
||||
<p>If you want to open a file with TextEdit, just use instead of <code>-a</code>
|
||||
the flag <code>-e</code> and write the path and the name of the file you want
|
||||
to open.</p>
|
||||
|
||||
<pre>
|
||||
User-Device:~ user$ open -e Desktop/text.txt
|
||||
</pre>
|
||||
|
||||
<h3>Open the folder which contains the file</h3>
|
||||
<p>If you want to open the folder that contains a specific file, just use
|
||||
the flag <code>-R</code> and write the path and the name of the file you want to open.
|
||||
</p>
|
||||
<pre>
|
||||
User-Device:~ user$ open -R Desktop/text.txt
|
||||
</pre>
|
||||
|
||||
<p>As result, a new <i>Finder</i> window opens the folder displaying its content.</p>
|
||||
|
||||
<h3>Open a file as a text</h3>
|
||||
<p>If you want to open a file with your default text editor (determined via
|
||||
LaunchServices), just use the flag <code>-t</code> and write the path and the name of
|
||||
the file you want to open.</p>
|
||||
<pre>
|
||||
User-Device:~ user$ open -t Desktop/text.txt
|
||||
</pre>
|
||||
|
||||
<h3>Visit a Website</h3>
|
||||
<p>You can use this tool not only to open files and folders, but also webpages.
|
||||
Just write the command <code>open</code> followed by the <code>URL</code> of the page
|
||||
you want to visit. For example, by typing the command</p>
|
||||
<pre>
|
||||
User-Device:~ user$ open http://www.google.com
|
||||
</pre>
|
||||
<p>A new page of your default browser will open on the indicated page (in this
|
||||
example, the main page of the Google Search Engine). </p>
|
50
site/pages/cmd/basic/openshell.html
Normal file
50
site/pages/cmd/basic/openshell.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
layout: page
|
||||
author: De Vita Gianmarco
|
||||
title: Open the Shell
|
||||
---
|
||||
<p>The tool that allows us to interact with the system with the shell is the terminal.
|
||||
There are mainly two ways to access to the terminal on a MacOS system.</p>
|
||||
|
||||
<h3>Through the Finder</h3>
|
||||
<ol>
|
||||
<li>Open a new <i>Finder</i> window by clicking on the icon on the system dock.</li>
|
||||
<img src="" alt="Open Finder" height="">
|
||||
<li>On the menu bar, click on <i>Go</i>.</li>
|
||||
<img src="" alt="Click on Go" height="">
|
||||
<li>Click on <i>Utilities</i>.</li>
|
||||
<img src="" alt="Click on Utilities" height="">
|
||||
<li>Look for <i>Terminal</i> and click on it.</li>
|
||||
<img src="" alt="Open Terminal" height="">
|
||||
</ol>
|
||||
<h3>Through <i>Spotlight</i></h3>
|
||||
<ol>
|
||||
<li>You can use the shortcut <code>cmd+space</code> to access to <i>Spotlight</i>.</li>
|
||||
<img src="" alt="Access to Spotlight" height="">
|
||||
<li>Then search for <i>Terminal</i>.</li>
|
||||
<img src="" alt="Search Terminal" height="">
|
||||
<li>Click on the <i>Terminal</i> icon displayed as result.</li>
|
||||
<img src="" alt="Open Terminal" height="">
|
||||
</ol>
|
||||
|
||||
<p>As you open the Terminal, a new blank window opens: </p>
|
||||
|
||||
<img src="" alt="Terminal Blank Window" height="">
|
||||
|
||||
<p> You can notice that the top lines in the window follow this structure:</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Last login: Day Month 2 hh:mm:ss on console
|
||||
Device-name:~ username$
|
||||
{% endhighlight %}
|
||||
|
||||
<p>The tilde (~) just before your username means that the current position in
|
||||
which the terminal is working is the Home directory. The gray spot next to
|
||||
the symbol $ after your username indicates that you can write instructions
|
||||
in that space.</p>
|
||||
|
||||
<p>Now, you are ready to try and use some simple commands
|
||||
to familiarize with this interface.</p>
|
||||
|
||||
<p>Notice that you can work simultaneously on multiple sessions of the Terminal.
|
||||
Just by pushing <code>cmd+T</code>, a new blank window will open without closing the current.</p>
|
71
site/pages/cmd/basic/say.html
Normal file
71
site/pages/cmd/basic/say.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
layout: page
|
||||
author: De Vita Gianmarco
|
||||
title: SAY
|
||||
---
|
||||
<p>You can convert text into audible speech just by writing the command
|
||||
<code>say</code> followed by a string. This is possible thanks to the
|
||||
Speech Synthesis manager.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Device-name:Current-position username$ say string
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Naturally, the wide presence of flags for this command allows you to use
|
||||
this command for many different tasks. Notice that using more flag
|
||||
simultaneously, you will be able to solve more complex operations.</p>
|
||||
|
||||
<h3>Read a particular file</h3>
|
||||
<p>By writing the command followed by the flag <code>-f</code> and, instead
|
||||
of the string, by the path of a text file, you will get as output a voice
|
||||
reading the content of that file.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Device-name:Current-position username$ say -f path/text.txt
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>Specify the reading voice</h3>
|
||||
<p>By writing the flag <code>-v</code> followed by a person name and a string, you
|
||||
can decide which voice should read the string.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -v name string
|
||||
{% endhighlight %}
|
||||
|
||||
<p><b>Notice.</b> Of course, you're not expected to know every possible voice,
|
||||
so, by writing "?" as argument of the command (including also the flag -v),
|
||||
you will get a list of all the available voices.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -v ?
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>Specify the Speech Rate</h3>
|
||||
<p>By writing the flag <code>-r</code> followed by a rate and then by a
|
||||
string, you can decide the reading speed in words per minute.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -r rate string
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>Store the output in an audible file</h3>
|
||||
<p>You can save the result of the command in an audible file. To do that,
|
||||
you have just to write after the command the flag <code>-o</code> followed
|
||||
by the path/name of the output file and then the string that has to be read.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -o path/audiofile.*format string
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>Exercise - Flags combinations</h3>
|
||||
<p>As said above, you can use more flags in the same command, once you know
|
||||
well them. See the examples below and try to guess the output. You can
|
||||
copy these commands into your terminal to verify your answers.</p>
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -v Alex -f hello_world.txt
|
||||
{% endhighlight %}
|
||||
|
||||
{% highlight ruby linenos %}
|
||||
Current-position username$ say -o hi.aac -f hello_world.txt
|
||||
{% endhighlight %}
|
Loading…
Reference in a new issue