proj: code review 1.1
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@130 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
4b45e13859
commit
67a86268c1
22 changed files with 438 additions and 498 deletions
|
@ -5,26 +5,37 @@ category-page: basic
|
|||
tags: directory change navigate
|
||||
author: Alessandro Marinelli
|
||||
title: cd
|
||||
previous-page: pages/cmd/basic/cd.html
|
||||
previous-page: pages/cmd/basic/open.html
|
||||
next-page: pages/cmd/basic/ls.html
|
||||
---
|
||||
<p>
|
||||
The <code>cd</code> command is used to change the working directory<br>
|
||||
The name stands for <i>Change Directory</i>.<br>
|
||||
|
||||
<p>The <code>cd</code> command is used to change the working directory<br>
|
||||
The name stands for <i>Change Directory</i>. </p>
|
||||
<h2>Syntax</h2>
|
||||
<p>The default cd command syntax is:
|
||||
<pre>cd [flags] [path]</pre>
|
||||
Where [flags] are the cd flags, read below for more info,and [path] is the
|
||||
path (absolute or relative), of the directory which we want to make as working directoty</p>
|
||||
<h2>Usage</h2> <br>
|
||||
<h3> Change the working directory</h3>
|
||||
<p> Let's see how to use the command <code> cd </code> in order to change the working directory</p>
|
||||
<pre>
|
||||
Device-Name:~ YourName$ cd Desktop/Multimedia.Folder/
|
||||
Device-Name:Multimedia.Folder YourName$
|
||||
</pre>
|
||||
<p> As you can see, we changed the working directory from ~ (which stands for HOME),
|
||||
to <code>Multimedia.Folder</code>. Now our Shell will work on the directory <code>Multimedia.Folder</code>
|
||||
until a new <code>cd</code> will occour. </p>
|
||||
<p> <b> Notice: </b> If you want to move to a directory which is not contained in <thead>
|
||||
current working directory, you <u>MUST</u> use the absolute path.</p>
|
||||
The default cd command syntax is:
|
||||
|
||||
<pre>
|
||||
cd [flags] [path]
|
||||
</pre>
|
||||
|
||||
Where [flags] are the cd flags, read below for more info,and [path] is the
|
||||
path (absolute or relative), of the directory which we want to make as working directory.<br><br>
|
||||
|
||||
<h3>Change the working directory</h3>
|
||||
Let's see how to use the command <code>cd</code> in order to change the working directory
|
||||
|
||||
<pre>
|
||||
pwd
|
||||
~
|
||||
cd Desktop/multimedia
|
||||
pwd
|
||||
~/Desktop/multimedia
|
||||
</pre>
|
||||
|
||||
As you can see, we changed the working directory from ~ (which stands for HOME),
|
||||
to "multimedia". Now our Shell will work on the directory "multimedia"
|
||||
until a new <code>cd</code> will occour.<br>
|
||||
|
||||
<b> Notice:</b> If you want to move to a directory which is not contained in the
|
||||
current working directory, you <u>MUST</u> use the absolute path.
|
||||
</p>
|
||||
|
|
|
@ -5,52 +5,47 @@ category-page: basic
|
|||
tags: manual
|
||||
author: Gianmarco De Vita
|
||||
title: info
|
||||
previous-page: pages/cmd/basic/cd.html
|
||||
next-page: pages/cmd/basic/ls.html
|
||||
previous-page: pages/cmd/basic/mkdir.html
|
||||
next-page: pages/cmd/basic/man.html
|
||||
---
|
||||
<p> An <i>.info</i> file is an information document created by Texinfo.
|
||||
It stores documentation in a book format with chapters, sections,
|
||||
and subsections and can contain up to four layers of depth.
|
||||
Info documents are used for storing software help manuals and technical books.
|
||||
The <code>info</code> command allows you to read that kind of files
|
||||
and to search for particular information by using special flags.</p>
|
||||
<p>
|
||||
An <i>.info</i> file is an information document created by Texinfo.<br>
|
||||
It stores documentation in a book format with chapters, sections,
|
||||
and subsections and can contain up to four layers of depth.<br>
|
||||
Info documents are used for storing software help manuals and technical books.<br>
|
||||
The <code>info</code> command allows you to read that kind of files
|
||||
and to search for particular information by using special flags.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ info [flag] [item]
|
||||
</pre>
|
||||
|
||||
<p>By writing the command <code>info</code> followed by nothing, as result you
|
||||
will get a list of what you can do with that command.</p>
|
||||
|
||||
info [flag] [item]
|
||||
</pre><br>
|
||||
|
||||
<h3>Look up for a specific string</h3>
|
||||
<p>Using the <code>--apropos</code> flag followed by a string, you obtain as
|
||||
output a list of all the contents which correspond to the string you wrote.</p>
|
||||
output a list of all the contents which correspond to the string you wrote.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ info --apropos string
|
||||
info --apropos string
|
||||
</pre>
|
||||
|
||||
<p>If the string you inserted has nothing to do with the content of the info files,
|
||||
you will get a error message. For example:</p>
|
||||
If the string you inserted has nothing to do with the content of the info files,
|
||||
you will get a error message. For example:
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ info --apropos duck
|
||||
info: No available info files have `duck' in their indices.
|
||||
</pre>
|
||||
info --apropos duck
|
||||
info: No available info files have `duck' in their indices.
|
||||
</pre><br>
|
||||
|
||||
<h3>An help with this command</h3>
|
||||
<p>Using the <code>-h</code> flag (which stands for help), you obtain as
|
||||
output a brief paragraph in which are explained the features of this command.</p>
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ info -h
|
||||
</pre>
|
||||
Using the <code>-h</code> flag (which stands for help), you obtain as
|
||||
output a brief paragraph in which are explained the features of this command.<br><br>
|
||||
|
||||
<h3>Visit a specific <i>.info</i> file</h3>
|
||||
<p>Using the <code>-f</code> flag followed by the path and a <i>.info</i> file, you
|
||||
as output obtain the content of that file.</p>
|
||||
|
||||
Using the <code>-f</code> flag followed by the path and a <i>.info</i> file, you
|
||||
as output obtain the content of that file.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ info -f path/filename.info
|
||||
info -f path/filename.info
|
||||
</pre>
|
||||
</p>
|
||||
|
|
|
@ -6,68 +6,81 @@ tags: directory list
|
|||
author: Alessandro Marinelli
|
||||
title: ls
|
||||
previous-page: pages/cmd/basic/cd.html
|
||||
next-page: pages/cmd/basic/mkdir.html
|
||||
---
|
||||
<p>
|
||||
The <code>ls</code> command is used to list a directory content or a file.<br>
|
||||
The name stands for <i>LiSt</i>.
|
||||
|
||||
<p>The <code>ls</code> command is used to list a directory content or a file.<br>
|
||||
The name stands for <i>LiSt</i>.
|
||||
<h2>Syntax</h2>
|
||||
<p>The default ls command syntax is:
|
||||
<pre>ls [flags] [path]</pre>
|
||||
Where [flags] are the ls flags, read below for more info,and [path] is the
|
||||
(optional) path (absolute or relative).If no path is provided the current
|
||||
directory is listed.</p>
|
||||
<h2>Usage</h2> <br>
|
||||
<h3> List the elements on the current working directory </h3>
|
||||
<p> Let's see how to show a list containing the elements included in the
|
||||
current working directory</p>
|
||||
<pre>
|
||||
Device-name:Multimedia.Folder YourName$ ls
|
||||
Other Multimedia This is a file,not a folder.jpg
|
||||
Photos Videos
|
||||
The default ls command syntax is:
|
||||
|
||||
<pre>
|
||||
ls [flags] [path]
|
||||
</pre>
|
||||
<p> As you can see, typing <code> ls</code> in the Unix Shell, will give as output
|
||||
the list of elements contained in the actual working directory,which,in our case, is a folder named <u><code>Multimedia.folder</code></u>.<br>
|
||||
Elements listed can be files (look for exemple at the element<u><code> This is a file,not a folder.jpg</code></u>),
|
||||
such as other directories
|
||||
(look for example at the folder <u> <code> Photos</code></u> ).
|
||||
<h3> List the elements contained in a directory </h3>
|
||||
<pre>
|
||||
Device-name:Multimedia.Folder YourName$ ls Photos
|
||||
|
||||
Where [flags] are the ls flags, read below for more info,and [path] is the
|
||||
(optional) path (absolute or relative).If no path is provided the current
|
||||
directory is listed.<br>
|
||||
|
||||
<h3>Usage</h3>
|
||||
|
||||
<h4>List the elements on the current working directory</h4>
|
||||
Let's see how to show a list containing the elements included in the
|
||||
current working directory
|
||||
|
||||
<pre>
|
||||
ls
|
||||
Other Multimedia my-cat.jpg
|
||||
Photos Videos
|
||||
</pre>
|
||||
|
||||
As you can see, typing <code>ls</code> in the Unix Shell, will give as output
|
||||
the list of elements contained in the current working directory.<br>
|
||||
Elements listed can be files (look for exemple at the element<i>my-cat.jpg</i>),
|
||||
such as other directories (look for example at the folder <i>Photos</i>).<br><br>
|
||||
|
||||
<h3>List the elements contained in a directory</h3>
|
||||
<pre>
|
||||
ls Photos
|
||||
01.jpg 02.jpg
|
||||
03.jpg 04.jpg
|
||||
</pre>
|
||||
<p> As you can see, now the Unix Shell is showing us the elements contained
|
||||
in the folder <u> <code> Photos</code></u>. </p>
|
||||
<p> <storng> Notice: </strong> <u> <code> Photos</code></u> is a valid path
|
||||
because it is actually the relative path of a folder contained in the current working directory.<br>
|
||||
You have to put the absolute path if you want to list elements which are not contained in the
|
||||
current working directory </p>
|
||||
|
||||
<h3> Show hidden files </h3>
|
||||
<p> You can include hidden files (those which name starts with ".") in the displayed list using the <u><code>-a</code></u> flag </p>
|
||||
<pre>
|
||||
Device-name:Multimedia.Folder YourName$ ls -a Photos
|
||||
. 01.png
|
||||
.. 02.png
|
||||
.DS_Store 03.png
|
||||
.secret.png 04.jpg
|
||||
</pre>
|
||||
<p>As you can see, now the SHELL shows more files for the same directory</p>
|
||||
|
||||
<h3> Show list in long format </h3>
|
||||
<pre>
|
||||
Device-Name:Photos YourName$ ls -l
|
||||
total 10816
|
||||
-rw-r--r--@ 1 YourName YourGroup 3143706 4 Ott 13:28 01.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 2269193 28 Ott 18:58 02.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 37900 28 Ott 22:07 03.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 75924 20 Ott 16:01 04.jpg
|
||||
</pre>
|
||||
<p> If the <u><code>-l</code></u> flag is given, the following information will be displayed for
|
||||
each file: file mode, number of links, owner name, group name, number of
|
||||
bytes in the file, abbreviated month, day-of-month file was last modi-
|
||||
fied, hour file last modified, minute file last modified, and the path-
|
||||
name. In addition, for each directory whose contents are displayed, the
|
||||
total number of 512-byte blocks used by the files in the directory is
|
||||
displayed on a line by itself, immediately before the information for the
|
||||
files in the directory. </p>
|
||||
|
||||
As you can see, now the Unix Shell is showing us the elements contained
|
||||
in the folder <i>Photos</i>.<br><br>
|
||||
|
||||
<h3>Show hidden files</h3>
|
||||
You can include hidden files (those which name starts with ".") in
|
||||
the displayed list using the <code>-a</code> flag.
|
||||
|
||||
<pre>
|
||||
ls -a Photos
|
||||
. 01.png
|
||||
.. 02.png
|
||||
.DS_Store 03.png
|
||||
.secret.png 04.jpg
|
||||
</pre>
|
||||
|
||||
As you can see, now the shell shows more files for the same directory.<br><br>
|
||||
|
||||
<h3>Show list in long format</h3>
|
||||
|
||||
<pre>
|
||||
ls -l
|
||||
total 10816
|
||||
-rw-r--r--@ 1 YourName YourGroup 3143706 4 Ott 13:28 01.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 2269193 28 Ott 18:58 02.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 37900 28 Ott 22:07 03.png
|
||||
-rw-r--r--@ 1 YourName YourGroup 75924 20 Ott 16:01 04.jpg
|
||||
</pre>
|
||||
|
||||
If the <code>-l</code> flag is given, the following information will be displayed for
|
||||
each file: file mode, number of links, owner name, group name, number of
|
||||
bytes in the file, abbreviated month, day-of-month file was last modified,
|
||||
hour file last modified, minute file last modified, and the path.
|
||||
|
||||
In addition, for each directory whose contents are displayed, the
|
||||
total number of 512-byte blocks used by the files in the directory is
|
||||
displayed on a line by itself, immediately before the information for the
|
||||
files in the directory.
|
||||
</p>
|
||||
|
|
|
@ -5,32 +5,26 @@ category-page: basic
|
|||
tags: manual
|
||||
author: Gianmarco De Vita
|
||||
title: man
|
||||
previous-page: pages/cmd/basic/cd.html
|
||||
next-page: pages/cmd/basic/ls.html
|
||||
previous-page: pages/cmd/basic/info.html
|
||||
next-page: pages/cmd/basic/say.html
|
||||
---
|
||||
<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>
|
||||
<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
|
||||
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>
|
||||
As result, a new session will be opened with information about the command
|
||||
you have typed (and more specifically about its functions and flags).<br>
|
||||
|
||||
<p>Using some flags, you can obtain with this command the same results you get
|
||||
when you use other commands. For istance:</p>
|
||||
Using some flags, you can obtain with this command the same results you get
|
||||
when you use other commands.<br><br>
|
||||
|
||||
<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>Flags</h3>
|
||||
|
||||
<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>
|
||||
<ul>
|
||||
<li> <b>-k</b>: returns the equivalent of <code>apropos</code></li>
|
||||
<li> <b>-f</b>: returns the equivalent of <code>whatis</code></li>
|
||||
</ul>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
---
|
||||
layout: page
|
||||
category-title: Basic commands
|
||||
|
@ -6,51 +5,54 @@ category-page: basic
|
|||
tags: directory list
|
||||
author: Alessandro Marinelli
|
||||
title: mkdir
|
||||
previous-page: pages/cmd/basic/cd.html
|
||||
previous-page: pages/cmd/basic/ls.html
|
||||
next-page: pages/cmd/basic/info.html
|
||||
---
|
||||
<p>
|
||||
The <code>mkdir</code> command is used to create new directories<br>
|
||||
The name stands for <i>MaKe DIRectory</i>.<br>
|
||||
|
||||
<p>The <code>mkdir</code> command is used to create new directories<br>
|
||||
The name stands for <i>MaKe DIRectory</i>.
|
||||
<h2>Syntax</h2>
|
||||
<p>The default ls command syntax is:
|
||||
<pre>mkdir [flags] [-m mode] directory_name ...</pre>
|
||||
Where [flags] are the mkdir <code> -p </code> and <code> -v </code> - flags,
|
||||
read below for more info,and <code> directory_name</code> is the
|
||||
name of the new directory we are going to create.</p>
|
||||
<h2>Usage</h2> <br>
|
||||
<h3>Create a new directory</h3>
|
||||
<p> Let's see how to create a new directory </p>
|
||||
<pre>
|
||||
Device-Name:test YourName$ mkdir test_directory
|
||||
Device-Name:test YourName$ ls
|
||||
test_directory
|
||||
The default ls command syntax is:
|
||||
|
||||
<pre>
|
||||
mkdir [flags] [-m mode] directory_name ...
|
||||
</pre>
|
||||
<p>Now we have created a new directory defined by the relative path <code> test/test_directory </code>.
|
||||
Let's use the command <code> ls</code> to see if the experiment succeded.
|
||||
<pre>
|
||||
Device-Name:test YourName$ ls
|
||||
test_directory
|
||||
</pre>
|
||||
<p> As you can see, the directory <code> test_directory </code> has been created
|
||||
inside the directory <code> test</code>
|
||||
|
||||
<h3> Create a Path of directories </h3>
|
||||
<p> Using the flag <code> -p</code> we can create a path of directories, allowing us
|
||||
to build more than a directory at once.</p>
|
||||
<pre>
|
||||
Device-Name:test lexinde$ mkdir -p test_directory/test_-pflag/A_Dir_in_a_Dir
|
||||
</pre>
|
||||
<p>As you can see, we are now creating two directories: one named <code> test_-pflag</code> and
|
||||
another one, included in this, named <code> A_Dir_in_a_Dir</code></p>
|
||||
<p><b>Notice:</b>the -p flag is necessary to allow the shell to create intermidiate
|
||||
directories as required </p>
|
||||
Where [flags] are the mkdir <code>-p</code> and <code>-v</code> - flags,
|
||||
read below for more info, and <i>directory_name</i> is the
|
||||
name of the new directory we are going to create.<br><br>
|
||||
|
||||
<h3> Create directories with specified permissions</h3>
|
||||
The <code>-m mode</code> option allows us to set permissions at the new directory
|
||||
that we are now creating.
|
||||
<pre>
|
||||
Device-Name:test YourName$ mkdir -m 777 test_free_directory
|
||||
<h3>Create a new directory</h3>
|
||||
Let's see how to create a new directory:
|
||||
|
||||
<pre>
|
||||
ls
|
||||
|
||||
mkdir test_directory
|
||||
ls
|
||||
test_directory
|
||||
</pre>
|
||||
<p>Our new directory will now have read,write and execute permissions for user, group and ...,.
|
||||
Go to <a href: pagina chmod> chmod </a> to see more infos about permissions. </p>
|
||||
|
||||
<h3>Create a path of directories</h3>
|
||||
Using the flag <code>-p</code> we can create a path of directories, allowing us
|
||||
to build more than a directory at once.
|
||||
|
||||
<pre>
|
||||
mkdir -p test_directory/subdir/subsubdir
|
||||
</pre>
|
||||
|
||||
As you can see, we are now creating two directories: one named <i>subdir</i> and
|
||||
another one, included in this, named <i>subsubdir</i><br>
|
||||
The -p flag is necessary to allow the shell to create intermediate
|
||||
directories as required.<br><br>
|
||||
|
||||
<h3>Create directories with specified permissions</h3>
|
||||
The <code>-m mode</code> option allows us to set permissions at the new directory
|
||||
that we are now creating.
|
||||
|
||||
<pre>
|
||||
mkdir -m 777 test_free_directory
|
||||
</pre>
|
||||
|
||||
Our new directory will now have read,write and execute permissions for user, group and others.
|
||||
</p>
|
||||
|
|
|
@ -1,79 +1,69 @@
|
|||
---
|
||||
layout: page
|
||||
category_title: Basic commands
|
||||
category-title: Basic commands
|
||||
category-page: basic
|
||||
tags: open
|
||||
author: Gianmarco De Vita
|
||||
title: open
|
||||
previous-page: pages/cmd/basic/openshell.html
|
||||
next-page: pages/cmd/basic/cd.html
|
||||
---
|
||||
<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>
|
||||
<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.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ open path/name-file
|
||||
</pre>
|
||||
open path/name-file
|
||||
</pre><br>
|
||||
|
||||
<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>
|
||||
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.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ open -a application-name path/name-file
|
||||
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>
|
||||
Assume that you want to open the file <i>abc.pdf</i> on my Desktop using the program "preview".
|
||||
|
||||
<pre>
|
||||
User-Device:~ user$ open -a preview Desktop/abc.pdf
|
||||
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>
|
||||
As result, a new <i>Preview</i> window appears showing the content of the
|
||||
chosen file.<br><br>
|
||||
|
||||
<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>
|
||||
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.
|
||||
|
||||
<pre>
|
||||
User-Device:~ user$ open -R Desktop/text.txt
|
||||
open -R Desktop/text.txt
|
||||
</pre>
|
||||
|
||||
<p>As result, a new <i>Finder</i> window opens the folder displaying its content.</p>
|
||||
As result, a new <i>Finder</i> window opens the folder displaying its content.<br><br>
|
||||
|
||||
<h3>Open a file with an editor</h3>
|
||||
If you want to open a file with your default editor,
|
||||
just use the flag <code>-t</code> and write the path and the name of
|
||||
the file you want to open.
|
||||
|
||||
<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>
|
||||
open -t Desktop/text.txt
|
||||
</pre><br>
|
||||
|
||||
<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>
|
||||
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 <i>URL</i> of the page
|
||||
you want to visit.
|
||||
|
||||
<pre>
|
||||
User-Device:~ user$ open http://www.google.com
|
||||
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>
|
||||
|
||||
A new page of your default browser will open on the indicated page (in this
|
||||
example, the main page of the Google Search Engine).
|
||||
|
|
|
@ -1,54 +1,57 @@
|
|||
---
|
||||
layout: page
|
||||
category_title: Basic commands
|
||||
category-title: Basic commands
|
||||
category-page: basic
|
||||
tags: Open the Shell
|
||||
author: Gianmarco De Vita
|
||||
title: Open the Shell
|
||||
next-page: pages/cmd/basic/ls.html
|
||||
next-page: pages/cmd/basic/open.html
|
||||
---
|
||||
<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>
|
||||
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="">
|
||||
<img src="" alt="Open Finder" />
|
||||
<li>On the menu bar, click on <i>Go</i>.</li>
|
||||
<img src="" alt="Click on Go" height="">
|
||||
<img src="" alt="Click on Go" />
|
||||
<li>Click on <i>Utilities</i>.</li>
|
||||
<img src="" alt="Click on Utilities" height="">
|
||||
<img src="" alt="Click on Utilities" />
|
||||
<li>Look for <i>Terminal</i> and click on it.</li>
|
||||
<img src="" alt="Open Terminal" height="">
|
||||
<img src="" alt="Open Terminal" />
|
||||
</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="">
|
||||
<img src="" alt="Access to Spotlight" />
|
||||
<li>Then search for <i>Terminal</i>.</li>
|
||||
<img src="" alt="Search Terminal" height="">
|
||||
<img src="" alt="Search Terminal" />
|
||||
<li>Click on the <i>Terminal</i> icon displayed as result.</li>
|
||||
<img src="" alt="Open Terminal" height="">
|
||||
<img src="" alt="Open Terminal" />
|
||||
</ol>
|
||||
|
||||
<p>As you open the Terminal, a new blank window opens: </p>
|
||||
As you open the Terminal, a new blank window opens:
|
||||
|
||||
<img src="" alt="Terminal Blank Window" height="">
|
||||
<img src="" alt="Terminal Blank Window" />
|
||||
|
||||
<p> You can notice that the top lines in the window follow this structure:</p>
|
||||
You can notice that the top lines in the window follow this structure:
|
||||
|
||||
<pre>
|
||||
Last login: Day Month 2 hh:mm:ss on console
|
||||
Last login: Day Month hh:mm:ss on console
|
||||
Device-name:~ username$
|
||||
</pre>
|
||||
|
||||
<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>
|
||||
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.<br>
|
||||
|
||||
<p>Now, you are ready to try and use some simple commands
|
||||
to familiarize with this interface.</p>
|
||||
Now, you are ready to try and use some simple commands
|
||||
to familiarize with this interface.<br>
|
||||
|
||||
<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>
|
||||
Note that you can work simultaneously on multiple sessions of the Terminal.
|
||||
</p>
|
||||
|
|
|
@ -1,76 +1,77 @@
|
|||
---
|
||||
layout: page
|
||||
category_title: Basic commands
|
||||
category-title: Basic commands
|
||||
category-page: basic
|
||||
tags: say
|
||||
author: Gianmarco De Vita
|
||||
title: say
|
||||
previous-page: pages/cmd/basic/man.html
|
||||
---
|
||||
<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>
|
||||
<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 <i>Speech Synthesis manager</i> on Mac OS.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say string
|
||||
say string
|
||||
</pre>
|
||||
|
||||
<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>
|
||||
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.<br><br>
|
||||
|
||||
<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>
|
||||
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.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -f path/text.txt
|
||||
</pre>
|
||||
say -f path/text.txt
|
||||
</pre><br>
|
||||
|
||||
<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>
|
||||
By writing the flag <code>-v</code> followed by a person name and a string, you
|
||||
can decide which voice should read the string.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -v name string
|
||||
say -v name string
|
||||
</pre>
|
||||
|
||||
<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>
|
||||
Of course, you're not expected to know every possible voice,
|
||||
so, by writing a string (eg: "Hello world") as argument of the command
|
||||
(including also the flag -v), you will get a list of all the available voices.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -v ?
|
||||
</pre>
|
||||
say -v "Hello world"
|
||||
</pre><br>
|
||||
|
||||
<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>
|
||||
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.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -r rate string
|
||||
</pre>
|
||||
ay -r rate string
|
||||
</pre><br>
|
||||
|
||||
<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>
|
||||
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.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -o path/audiofile.*format string
|
||||
say -o path/audiofile.*format string
|
||||
</pre>
|
||||
|
||||
<h3>Try by yourself - 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. Naturally,
|
||||
you have to create the text files if they don't exist (with some text
|
||||
inside), to make the work.</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. Naturally,
|
||||
you have to create the text files if they don't exist (with some text
|
||||
inside), to make the work.
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -v Alex -f hello_world.txt
|
||||
say -v Alex -f hello_world.txt
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
Device-name:Current-position username$ say -o hi.aac -f hello_world.txt
|
||||
say -o hi.aac -f hello_world.txt
|
||||
</pre>
|
||||
|
|
|
@ -6,12 +6,11 @@ tags: basename suffix prefix name
|
|||
author: Fabiano Fenini
|
||||
title: basename
|
||||
---
|
||||
|
||||
<p>The <code>basename</code> command deletes any prefix ending with the last slash "/" character
|
||||
<p>
|
||||
The <code>basename</code> command deletes any prefix ending with the last slash "/" character
|
||||
present in string and also a suffix.
|
||||
|
||||
<h2>Usage</h2>
|
||||
|
||||
<h3>Usage</h3>
|
||||
The default basename command syntax is:
|
||||
|
||||
<pre>
|
||||
|
@ -19,9 +18,9 @@ basename [flags] [string] [suffix]
|
|||
</pre>
|
||||
|
||||
Where [flags] are the cat flags, read below for more info, the string command is
|
||||
the pathname and the suffix, if indicated, will be also deleted.
|
||||
the pathname and the suffix, if indicated, will be also deleted.<br><br>
|
||||
|
||||
<h2>Flags</h2>
|
||||
<h3>Flags</h3>
|
||||
|
||||
Here are some of the most common basename flags:
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
layout: page
|
||||
category: Intermediate commands
|
||||
category-page: intermediate
|
||||
category-title: Intermediate commands
|
||||
tags: cat content file show concatenate
|
||||
author: Fabiano Fenini
|
||||
title: cat
|
||||
---
|
||||
|
||||
<p>The <code>cat</code> command can be easily associated to the word “concatenation” but
|
||||
<p>
|
||||
The <code>cat</code> command can be easily associated to the word “concatenation” but
|
||||
it doesn’t have that only function: in fact, cat command gives us the possibility to create
|
||||
files and also to display them.
|
||||
<br>
|
||||
The name stands for <i>catenate</i>.
|
||||
files and also to display them.<br>
|
||||
|
||||
<h2>Usage</h2>
|
||||
The name stands for <i>catenate</i>.<br><br>
|
||||
|
||||
<h3>Usage</h3>
|
||||
|
||||
The default cat command syntax is:
|
||||
|
||||
|
@ -21,13 +21,13 @@ The default cat command syntax is:
|
|||
cat [flags] [--] [file1] [file2] [file...]
|
||||
</pre>
|
||||
|
||||
Where [flags] are the cat flags, read below for more info, [--] indacates that the
|
||||
Where [flags] are the <code>cat</code> flags, read below for more info, [--] indacates that the
|
||||
following parameters won't be considered as flags, while the file parameters indicates
|
||||
the names of one or more files to concatenate.
|
||||
Between the names of two files is possible to use the shell redirection symbol ">",
|
||||
in order to redirect the output to the file considered.
|
||||
in order to redirect the output to the file considered.<br><br>
|
||||
|
||||
<h2>Flags</h2>
|
||||
<h3>Flags</h3>
|
||||
Here are some of the most common cat flags:
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
---
|
||||
layout: page
|
||||
category: Intermediate commands
|
||||
category-page: intermediate
|
||||
category-title: Intermediate commands
|
||||
tags: password change pwd user
|
||||
author: Fabiano Fenini
|
||||
title: passwd
|
||||
previous-page: ""
|
||||
---
|
||||
<p>The <code>passwd</code> command allows us to change or to assign a password of authentication
|
||||
<p>
|
||||
The <code>passwd</code> command allows us to change or to assign a password of authentication
|
||||
of an user currently in the system.<br>
|
||||
When the user doesn’t have particular privileges, he is only able to change is password,
|
||||
while the root user has the possibility to change also other users’ passwords.<br>
|
||||
The command name stands for <i>password</i>.
|
||||
The command name stands for <i>password</i>.<br><br>
|
||||
|
||||
<h2>Usage</h2>
|
||||
<h3>Usage</h3>
|
||||
|
||||
The default passwd command syntax is:
|
||||
|
||||
|
@ -23,9 +24,9 @@ passwd [flags] [user]
|
|||
|
||||
Where [flags] are the passwd flags, read below for more info, the parameter [user] can only be
|
||||
specified by the root user. If no user is provided, passwd proceed to set the password of the
|
||||
user who uses this command. You will first be asked to enter the current user password.
|
||||
user who uses this command. You will first be asked to enter the current user password.<br><br>
|
||||
|
||||
<h2>Flags</h2>
|
||||
<h3>Flags</h3>
|
||||
|
||||
Here are some of the most common passwd flags:
|
||||
|
||||
|
@ -36,5 +37,4 @@ Here are some of the most common passwd flags:
|
|||
<li> <b>-u</b>: Unlock the password </li>
|
||||
<li> <b>-S</b>: See the account status information </li>
|
||||
</ul>
|
||||
|
||||
</p>
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
---
|
||||
layout: page
|
||||
category-title: fs
|
||||
category-page: FileSystem
|
||||
tags: list file
|
||||
author: Mirko Ponzio
|
||||
title: ls
|
||||
---
|
||||
<p>
|
||||
<h1>LS, list directory contents</h1>
|
||||
<h2>What is LS?</h2>
|
||||
|
||||
<p>
|
||||
In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification.
|
||||
When invoked without any arguments, ls lists the files in the current working directory. The command is also available in the EFI shell.
|
||||
In other environments, such as DOS and Microsoft Windows, similar functionality is provided by the dir command.
|
||||
<br><br>
|
||||
|
||||
Unix and Unix-like operating systems maintain the idea of a current working directory, that is, where one is currently positioned in the hierarchy of directories.
|
||||
When invoked without any arguments, ls lists the files in the current working directory.
|
||||
If another directory is specified, then ls will list the files there, and in fact the user may specify any list of files and directories to be listed.
|
||||
<br><br>
|
||||
|
||||
Files whose names start with "." are not listed, unless the -a flag is specified, the -A flag is specified, or the files are specified explicitly.
|
||||
<br><br>
|
||||
|
||||
Without options, ls displays files in a bare format. This bare format however makes it difficult to establish the type, permissions, and size of the files.
|
||||
The most common options to reveal this information or change the list of files are:
|
||||
<ul>
|
||||
<li> -l long format, displaying Unix file types, permissions, number of hard links, owner, group, size, last-modified date and filename </li>
|
||||
<li> -f do not sort. Useful for directories containing large numbers of files. </li>
|
||||
<li> -F appends a character revealing the nature of a file, for example, * for an executable, or / for a directory. Regular files have no suffix.</li>
|
||||
<li> -a lists all files in the given directory, including those whose names start with "." (which are hidden files in Unix). By default, these files are excluded from the list.</li>
|
||||
<li> -R recursively lists subdirectories. The command ls -R / would therefore list all files. </li>
|
||||
<li> -d shows information about a symbolic link or directory, rather than about the link's target or listing the contents of a directory. </li>
|
||||
<li> -t sort the list of files by modification time. </li>
|
||||
<li> -h print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) This option is not part of the POSIX standard,
|
||||
although implemented in several systems, e.g., GNU coreutils in 1997, FreeBSD 4.5 in 2002, and Solaris 9 in 2002. </li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2> LS, all commands </h2>
|
||||
<p> The following options are available: </p><br>
|
||||
<p>-@ <br>
|
||||
|
||||
Display extended attribute keys and sizes in long (-l) output.
|
||||
</p> <br>
|
|
@ -4,57 +4,34 @@ category-page: fs
|
|||
category-title: FileSystem
|
||||
tags: absolute relative path
|
||||
author: Marwan Announ
|
||||
title: paths
|
||||
title: Absolute paths
|
||||
---
|
||||
|
||||
<p>
|
||||
A path is a location to a folder or file in a file system of a Operating System, then is a combination of characters
|
||||
and "/"
|
||||
</p>
|
||||
A path is a location to a folder or file in a file system of a Operating System,
|
||||
then is a combination of characters and "/".<br>
|
||||
|
||||
<p>
|
||||
An absolute path is defined as specifying the location of a file or directory from the root directory(/).
|
||||
In other words we can say absolute path is a complete path from start of actual filesystem from / directory.
|
||||
</p>
|
||||
An absolute path is defined as specifying the location of a file or directory
|
||||
from the root directory (/).In other words we can say absolute path is a complete
|
||||
path from start of actual filesystem from / directory.<br><br>
|
||||
|
||||
<h4>To write an absolute path-name:</h4>
|
||||
<h3>To write an absolute path-name:</h3>
|
||||
|
||||
<p>
|
||||
Start at the root directory ( / ) and work down.
|
||||
<br>Write a slash ( / ) after every directory name (last one is optional)
|
||||
</p>
|
||||
Start at the root directory ( / ) and work down.<br>
|
||||
Write a slash ( / ) after every directory name (last one is optional).<br>
|
||||
|
||||
<h5>Example:</h5>
|
||||
If for example, we the commands "cat group1.txt", it'll work only and only if the "group1.txt"
|
||||
exist in the current directory.<br>
|
||||
If doesn't works, it's not a problem, you just have to know where the file is actually stored.<br>
|
||||
Now, we suppose that you know where your file is saved so you can rewrite the command.
|
||||
"cat /home/a1/group1.txt".<br>
|
||||
|
||||
<p> cat group1.txt </p>
|
||||
if for example, we use the above line, this commands work only and only if the "group1.txt" exist in the current
|
||||
directory.
|
||||
<br> If not works, it's not a problem, the file is present somewhere, before restart the new command, you have to
|
||||
know where
|
||||
<br> the file is saved.
|
||||
<br> Now, we supposed that you know where your file is saved you can rewrite the command.
|
||||
<p> cat /home/a1/group1.txt</p>
|
||||
Now, we suppose that the file is saved into folder a1 in home,
|
||||
<br>where: /home is the location respect to root, in fact, you have to descend one level
|
||||
<br>in the file system like above to access your file.
|
||||
As you can see from the last commands, the path started from "/" which is the root directory
|
||||
for every Unix machines.<br>
|
||||
|
||||
As you can see from the last commands, all the paths started from /directory whis is a root directory for every Unix
|
||||
machines.
|
||||
Here are some other examples of absolute paths:
|
||||
|
||||
<p> Other examples, where all are absolute path</p>
|
||||
|
||||
/home/user/Document/group1.txt
|
||||
/root/data/dev.jpg
|
||||
/var/log/messages
|
||||
|
||||
<h5>Example of Absolute path's uses:</h5>
|
||||
Now, as we learned from the previous pages we can use other commands in addition to "cat", such as:
|
||||
|
||||
<br>ls /etc
|
||||
<br>ls /usr/share/games if you have games obviously :)
|
||||
<br>cd /usr/share/games
|
||||
<br>cd ~
|
||||
<br>cat /etc/passwd
|
||||
<br>cp /etc/passwd /tmp
|
||||
<br>cd /tmp
|
||||
<br>cat passwd
|
||||
<ul>
|
||||
<li>/home/user/Document/group1.txt</li>
|
||||
<li>/root/data/dev.zip</li>
|
||||
<li>/var/log/messages</li>
|
||||
</ul>
|
||||
|
|
|
@ -6,9 +6,6 @@ tags: change directory
|
|||
author: Mirko Ponzio
|
||||
title: cd
|
||||
---
|
||||
<h1> cd, change directory</h1>
|
||||
<h2> what is cd<h2>
|
||||
|
||||
<p> Nei sistemi operativi Unix e Unix-like, e più in generale nei sistemi POSIX[1], cd (abbreviazione dalla lingua inglese di change directory,
|
||||
cambia directory) è un comando interno delle shell testuali che cambia la directory corrente della shell da cui viene eseguito. <br><br>
|
||||
|
47
site/pages/fs/ls.html
Normal file
47
site/pages/fs/ls.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
layout: page
|
||||
tags: list file
|
||||
author: Mirko Ponzio
|
||||
title: ls
|
||||
---
|
||||
<p>
|
||||
The command <code>ls</code> stands for "LiSt"<br>
|
||||
|
||||
In computing, ls is a command to list computer files in Unix and Unix-like operating systems.
|
||||
ls is specified by POSIX and the Single UNIX Specification.<br>
|
||||
When invoked without any arguments, ls lists the files in the current working directory.<br>
|
||||
The command is also available in the EFI shell. In other environments, such as DOS and Microsoft
|
||||
Windows, similar functionality is provided by the dir command.<br>
|
||||
|
||||
Unix and Unix-like operating systems maintain the idea of a current working directory,
|
||||
that is, where one is currently positioned in the hierarchy of directories.<br>
|
||||
When invoked without any arguments, ls lists the files in the current working directory.
|
||||
If another directory is specified, then ls will list the files there, and in fact the user may
|
||||
specify any list of files and directories to be listed.<br>
|
||||
|
||||
Files whose names start with "." are not listed, unless the -a flag is specified,
|
||||
the -A flag is specified, or the files are specified explicitly.<br>
|
||||
|
||||
Without options, ls displays files in a bare format. This bare format however makes
|
||||
it difficult to establish the type, permissions, and size of the files.<br><br>
|
||||
|
||||
<h3>Flags</h3>
|
||||
|
||||
The most common options to reveal this information or change the list of files are:
|
||||
<ul>
|
||||
<li> -l long format, displaying Unix file types, permissions, number of hard links,
|
||||
owner, group, size, last-modified date and filename </li>
|
||||
<li> -f do not sort. Useful for directories containing large numbers of files. </li>
|
||||
<li> -F appends a character revealing the nature of a file, for example, * for an executable,
|
||||
or / for a directory. Regular files have no suffix.</li>
|
||||
<li> -a lists all files in the given directory, including those whose names start with "."
|
||||
(which are hidden files in Unix). By default, these files are excluded from the list.</li>
|
||||
<li> -R recursively lists subdirectories. The command ls -R / would therefore list all files. </li>
|
||||
<li> -d shows information about a symbolic link or directory, rather than about the link's
|
||||
target or listing the contents of a directory. </li>
|
||||
<li> -t sort the list of files by modification time. </li>
|
||||
<li> -h print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) This option is not
|
||||
part of the POSIX standard, although implemented in several systems, e.g.,
|
||||
GNU coreutils in 1997, FreeBSD 4.5 in 2002, and Solaris 9 in 2002. </li>
|
||||
</ul>
|
||||
</p>
|
|
@ -1,15 +1,12 @@
|
|||
---
|
||||
layout: page
|
||||
category-title: fs
|
||||
category-page: FileSystem
|
||||
tags: lS
|
||||
tags: create directory make
|
||||
author: Mirko Ponzio
|
||||
title: PWD
|
||||
title: mkdir
|
||||
---
|
||||
|
||||
<h1> MKDIR , make directories </h1>
|
||||
The command <code>mkdir</code> stands for "MaKeDIRectory"</br>
|
||||
|
||||
<h2> what is mkdir </h2>
|
||||
<p>
|
||||
The mkdir utility creates the directories named as operands, in the order specified, using mode rwxrwxrwx (0777) as modified by the current
|
||||
umask(2). </p>
|
||||
|
|
|
@ -6,15 +6,17 @@ tags: directory list move rename
|
|||
author: Mattia Hijman
|
||||
title: mv
|
||||
---
|
||||
|
||||
<p>The <code>mv</code> command is used to move a file from a given path to another. It can also be used to rename a file by moving it into the same directory, but with a different name.<br>
|
||||
<p>
|
||||
The <code>mv</code> command is used to move a file from a given path to another.
|
||||
It can also be used to rename a file by moving it into the same directory,
|
||||
but with a different name.<br>
|
||||
It stands for <i>MoVe</i>.
|
||||
|
||||
<pre>
|
||||
mv [-finv] source target
|
||||
</pre>
|
||||
|
||||
<h2>Flags</h2>
|
||||
<h3>Flags</h3>
|
||||
|
||||
<ul>
|
||||
<li> <b>-f</b>: Do not prompt for confirmation before overwriting the
|
||||
|
|
|
@ -1,43 +1,34 @@
|
|||
---
|
||||
layout: page
|
||||
category_title: File System
|
||||
category-page: fs
|
||||
category-title: FileSystem
|
||||
tags: working directory current position where
|
||||
author: Mirko Ponzio
|
||||
title: PWD
|
||||
title: pwd
|
||||
---
|
||||
|
||||
<h2>Description</h2>
|
||||
<p>
|
||||
<code>PWD</code> (abbreviation of print working directory, it gives you 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,
|
||||
and in general of the systems POSIX, that show on the standard output the
|
||||
absolute pathname on the corrent directory.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
are standing.<br>
|
||||
|
||||
The working directory is the directory where you are standing in. So for
|
||||
knowing where you are, you must use the pwd command.
|
||||
</p>
|
||||
knowing where you are, you must use the pwd command.<br><br>
|
||||
|
||||
|
||||
<h2>Options</h2>
|
||||
<p>
|
||||
<h3>Flags</h3>
|
||||
<ul>
|
||||
<li> -L : Display the logical current working directory.</li>
|
||||
|
||||
<li>-P : Display the physical current working directory (all symbolic
|
||||
<li> -L : Display the logical current working directory.</li>
|
||||
<li>-P : Display the physical current working directory (all symbolic
|
||||
links resolved).</li>
|
||||
</ul>
|
||||
<br><br>
|
||||
If no options are specified, the -L option is assumed.</p>
|
||||
|
||||
|
||||
|
||||
<h2> Examples <h2>
|
||||
If no options are specified, the -L option is assumed.
|
||||
</p>
|
|
@ -4,54 +4,21 @@ category-page: fs
|
|||
category-title: FileSystem
|
||||
tags: absolute relative path
|
||||
author: Marwan Announ
|
||||
title: fs
|
||||
title: Relative paths
|
||||
---
|
||||
|
||||
<h1>Relative Path!</h1>
|
||||
Relative path is defined as path related to the present working directory(pwd).<br>
|
||||
Suppose I am located in /home/user and I want to change directory to /home/user/Documents.<br>
|
||||
I can use relative path concept to change directory to Documents.
|
||||
|
||||
Relative path is defined as path related to the present working directory(pwd).
|
||||
<br>Suppose I am located in /home/user1 and I want to change directory to /home/user1/Documents.
|
||||
<br>I can use relative path concept to change directory to Documents.
|
||||
<br> <br> <br>
|
||||
<p> pwd/home/user1cd Documents </p>
|
||||
<pre>
|
||||
pwd
|
||||
/home/user
|
||||
cd Documents
|
||||
pwd
|
||||
/home/user/Documents
|
||||
</pre>
|
||||
|
||||
<br> <br> <br> Then you could tell me what is the difference between Absolute and Relative.
|
||||
|
||||
<br> If you observe, there is a little bit difference, where in relative there is no "/".
|
||||
<br> Meanwhyle using absolute path you have to write "/", in this case cd /home/user1/Documents.
|
||||
|
||||
<!-- esempi con altri comandi+foto -->
|
||||
|
||||
<h2>Example of Relative path's uses:</h2>
|
||||
Now, as we learned from the previous pages we can use other commands in addition to "cat", such as:
|
||||
|
||||
<br><br>pwd
|
||||
<br> cd .
|
||||
<br><br>pwd
|
||||
<br> cd ..
|
||||
<br><br>pwd
|
||||
<br> cd ..
|
||||
<br><br>pwd
|
||||
<br> cd
|
||||
|
||||
<br><br><br> and so on.. I know, it's boring but it is one of the disadvantages of not being present in the
|
||||
<br>working directory
|
||||
|
||||
<h3> Now I will show you in many examples.</h3>
|
||||
|
||||
<!--<p>
|
||||
<img src="1.1.jpg" alt=" pwd to know where i am "/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img src="1.2.jpg" alt="relative paths command"/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img src="1.3.jpg" alt=" funning with 'cd to return back"/>
|
||||
</p> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- quiz in javascript about relative and what the user know after the reading-->
|
||||
If you observe, there is a little bit difference between absolute and relative paths:
|
||||
in relative paths there is no "/" at the very beginning.<br>
|
||||
Meanwhile in an absolute path you have to write "/", in this case it'd be "/home/user/Documents".
|
||||
|
|
|
@ -6,17 +6,17 @@ tags: directory list remove delete erase
|
|||
author: Mattia Hijman
|
||||
title: rm
|
||||
---
|
||||
|
||||
<p>The <code>rm</code> command is used to delete and unlink directories and files.<br>
|
||||
<p>
|
||||
The <code>rm</code> command is used to delete and unlink directories and files.<br>
|
||||
It attempts to remove the non-directory type files specified on the command line.
|
||||
If the permissions of the file do not permit writing, the user is prompted for confirmation.<br>
|
||||
It stands for <i>ReMove</i>.
|
||||
|
||||
<pre>
|
||||
rm [-dfiPRrvW] file1 file2 file....
|
||||
</pre>
|
||||
</pre><br>
|
||||
|
||||
<h2>Flags</h2>
|
||||
<h3>Flags</h3>
|
||||
<ul>
|
||||
<li> <b>-d</b>: Attempt to remove directories as well as other types of files</li>
|
||||
<li> <b>-f</b>: Attempt to remove the files without prompting for confirmation, regardless
|
||||
|
@ -39,9 +39,9 @@ rm [-dfiPRrvW] file1 file2 file....
|
|||
<li> <b>-v</b>: Be verbose when deleting files, showing them as they are removed.</li>
|
||||
<li> <b>-W</b>: Attempt to undelete the named files.
|
||||
Currently, this option can only be used to recover files covered by whiteouts.</li>
|
||||
</ul>
|
||||
</ul><br>
|
||||
|
||||
<h2>Removing links</h2>
|
||||
<h3>Removing links</h3>
|
||||
|
||||
The rm utility removes symbolic links, not the files referenced by the links.<br>
|
||||
It is not allowed to remove the files "." or "..".<br>
|
||||
|
|
|
@ -7,6 +7,7 @@ author: Nicola Brunner
|
|||
title: Legal notice and copyright information
|
||||
---
|
||||
|
||||
<br>
|
||||
<h3>© 2018 THE SHELL - All rights reserved.</h3>
|
||||
<p>Any reproduction or distribution of material on the THE SHELL
|
||||
website for commercial purposes is prohibited without the express written
|
||||
|
@ -51,4 +52,4 @@ title: Legal notice and copyright information
|
|||
|
||||
<p>For any questions or additional information about legal notice and
|
||||
copyright, please contact the THE SHELL team at
|
||||
<a href="mailto:info@shell.ch">info@shell.ch</a></p>
|
||||
<a href="mailto:info@theshell.ch">info@theshell.ch</a></p>
|
||||
|
|
|
@ -6,13 +6,12 @@ tags: redirect output input
|
|||
author: Dario Rasic
|
||||
title: Redirection
|
||||
---
|
||||
<br>
|
||||
<!-- Output redirection text -->
|
||||
<h2>Output as input</h2>
|
||||
<p>
|
||||
<h3>Output as input</h3>
|
||||
|
||||
<p>To redirect a certain output of the command-line we have to use the symbol ">".<br>
|
||||
|
||||
In this case, we will use a file named "<i>hello.txt</i>", in which we want to insert
|
||||
In this case, we will use a file named <i>hello.txt</i>, in which we want to insert
|
||||
a certain output ("Sun" in this case):<br>
|
||||
|
||||
<pre>
|
||||
|
@ -20,9 +19,10 @@ echo "Sun" > hello.txt
|
|||
</pre>
|
||||
|
||||
So if we print the content of the file in our command-line, the output will be the following:
|
||||
|
||||
<pre>
|
||||
cat hello.txt
|
||||
Sun
|
||||
Sun
|
||||
</pre>
|
||||
|
||||
If we want to append a certain output to an existing file,
|
||||
|
@ -30,22 +30,22 @@ we just have to use ">>" symbols:</p>
|
|||
|
||||
<pre>
|
||||
cat hello.txt
|
||||
Sun
|
||||
Sun
|
||||
echo "Moon" >> hello.txt
|
||||
cat hello.txt
|
||||
Sun
|
||||
Moon
|
||||
Sun
|
||||
Moon
|
||||
</pre>
|
||||
|
||||
<!-- Input redirection text -->
|
||||
<h2>Input as output</h2>
|
||||
<h3>Input as output</h3>
|
||||
|
||||
To redirect an input from a file for a command, the symbol "<" is used.
|
||||
|
||||
<pre>
|
||||
echo < $(cat hello.txt)
|
||||
Sun
|
||||
Moon
|
||||
Sun
|
||||
Moon
|
||||
</pre>
|
||||
|
||||
This is particularly useful when chaining commands.
|
||||
|
@ -53,7 +53,7 @@ This is particularly useful when chaining commands.
|
|||
<br>
|
||||
|
||||
<!-- Chaining command text -->
|
||||
<h2>Chaining</h2>
|
||||
<h3>Chaining</h3>
|
||||
<br>
|
||||
<h1>To be completed</h1>
|
||||
|
||||
|
|
Loading…
Reference in a new issue