Difference between revisions of "Linux1"

From SourceWiki
Jump to navigation Jump to search
Line 4: Line 4:
 
Linux or GNU/Linux is an operating system, i.e. the middle man between you and the computer hardware. Therefore Linux is a full replacement for Microsoft Windows or Mac OS X. Linux comes with a range of graphical user interfaces where you can use the mouse to interact with the computer as you are used to. However, in most setup within the University (and particularly for the HPC facilities), you will not have access to this graphical user interface. Instead, you will be using Linux at the command line. Therefore this practical introduces some fundamentals commands so that you can carry out your research in a Linux based environment.
 
Linux or GNU/Linux is an operating system, i.e. the middle man between you and the computer hardware. Therefore Linux is a full replacement for Microsoft Windows or Mac OS X. Linux comes with a range of graphical user interfaces where you can use the mouse to interact with the computer as you are used to. However, in most setup within the University (and particularly for the HPC facilities), you will not have access to this graphical user interface. Instead, you will be using Linux at the command line. Therefore this practical introduces some fundamentals commands so that you can carry out your research in a Linux based environment.
  
The user interface on a computer is technically called a [http://en.wikipedia.org/wiki/Shell_(computing) shell]. When using Linux at the command line, most often the [http://en.wikipedia.org/wiki/Bash <tt>bash</tt> shell] is used. There are a range of shells for Linux with slightly different syntaxes. The <tt>bash</tt> shell is often the default and we will use <tt>bash</tt> syntax in this practical.
+
The user interface on a computer is technically called a [http://en.wikipedia.org/wiki/Shell_(computing) shell]. When using Linux at the command line, most often the [http://en.wikipedia.org/wiki/Bash <tt>bash</tt> shell] is used. There are a range of shells (csh, zsh ...) for Linux with slightly different syntaxes. The <tt>bash</tt> shell is often the default and we will use <tt>bash</tt> syntax in this practical.
  
 
=Logging in=
 
=Logging in=
Login is performed via a bit of software called secure shell or <tt>ssh</tt>. There is a client for Microsoft Windows which should be installed on your computer. If not, contact a computer officer. To login select the machine that you want to log into, for instance <tt>dylan.ggy.bris.ac.uk</tt> or <tt>bluecrystal.bris.ac.uk</tt> and then enter your username and password. the system will log you in and you will directly be taken to your home directory.
+
Login is performed via a bit of protocol called '''secure shell''' or <tt>ssh</tt>. There is a client for Microsoft Windows which should be installed on your computer. If not, contact a computer officer. To login select the machine that you want to log into, for instance <tt>dylan.ggy.bris.ac.uk</tt> or <tt>bluecrystal.bris.ac.uk</tt> and then enter your username and password. the system will log you in and you will directly be taken to your home directory.
 +
 
 +
Although you used your password to login, it is important to note that there are other options available. For instance, you can configure ssh to login automatically using authentification keys instead of using a password. This is very interesting when you want scripts to run automatically and perform operations on the network. This is really beyond the scope of this practical.
  
 
= Getting the content for this practical =  
 
= Getting the content for this practical =  
 
Now that you are logged in a Linux system, it is time to get the practical content. The necessary files for this practical are hosted in a version control system. To obtain them, just type the following command:
 
Now that you are logged in a Linux system, it is time to get the practical content. The necessary files for this practical are hosted in a version control system. To obtain them, just type the following command:
 
<pre>
 
<pre>
svn export http://source.ggy.bris.ac.uk/subversion-open/intro-to-linux/trunk intro-to-linux
+
$ svn export http://source.ggy.bris.ac.uk/subversion-open/intro-to-linux/trunk intro-to-linux
 
</pre>
 
</pre>
This will fetch all necessary files and put them in a folder called <tt>intro-to-linux/</tt>. Ignore the cryptic syntax so far, an introduction to version control will be given later on.
+
 
 +
The dollar sign "$" is caled the shell prompt, you do not need to type it in. It is merely there to show that the shell is waiting for a command.
 +
 
 +
This will fetch all necessary files and put them in a folder called <tt>intro-to-linux/</tt>. Ignore the cryptic syntax so far, an introduction to version control using subversion (svn) will be given later on.
  
 
=Navigation=
 
=Navigation=
To change directories, the command <tt>cd</tt> is used. It stands for ... "<b>c</b>hange <b>d</b>irectory" (!)
+
To change directories (folders), the command <tt>cd</tt> is used. It stands for ... "<b>c</b>hange <b>d</b>irectory" (!)
 
To navigate to the directory folder containing the file, type:
 
To navigate to the directory folder containing the file, type:
 
<pre>
 
<pre>
cd intro-to-linux
+
$ cd intro-to-linux
 
</pre>
 
</pre>
 +
 +
By doing this operation, you used a relative path. Indeed intro-to-linux is not the full directory location but merely its relative path from where you were before. To find out the absolute path of you current location, use the command <tt>pwd</tt> (<b>p</b>rint <b>w</b>orking <b>d</b>irectory):
 +
 +
<pre>
 +
$ pwd
 +
/gsa13/ggjpr/intro-to-linux
 +
</pre>
 +
 +
Obviously, the full path will depend on where your home directory is located. The absolute path starts at <tt>/</tt> called the '''root''' and then lists the branches of the directory tree leading to the current directory. Note that the directories are separated by slashes "<tt>/</tt>" and not backslashes as used by DOS in Microsoft Windows.
 +
  
  
 
=Creating/deleting/modifying=
 
=Creating/deleting/modifying=

Revision as of 19:21, 1 February 2008


Introduction

Linux or GNU/Linux is an operating system, i.e. the middle man between you and the computer hardware. Therefore Linux is a full replacement for Microsoft Windows or Mac OS X. Linux comes with a range of graphical user interfaces where you can use the mouse to interact with the computer as you are used to. However, in most setup within the University (and particularly for the HPC facilities), you will not have access to this graphical user interface. Instead, you will be using Linux at the command line. Therefore this practical introduces some fundamentals commands so that you can carry out your research in a Linux based environment.

The user interface on a computer is technically called a shell. When using Linux at the command line, most often the bash shell is used. There are a range of shells (csh, zsh ...) for Linux with slightly different syntaxes. The bash shell is often the default and we will use bash syntax in this practical.

Logging in

Login is performed via a bit of protocol called secure shell or ssh. There is a client for Microsoft Windows which should be installed on your computer. If not, contact a computer officer. To login select the machine that you want to log into, for instance dylan.ggy.bris.ac.uk or bluecrystal.bris.ac.uk and then enter your username and password. the system will log you in and you will directly be taken to your home directory.

Although you used your password to login, it is important to note that there are other options available. For instance, you can configure ssh to login automatically using authentification keys instead of using a password. This is very interesting when you want scripts to run automatically and perform operations on the network. This is really beyond the scope of this practical.

Getting the content for this practical

Now that you are logged in a Linux system, it is time to get the practical content. The necessary files for this practical are hosted in a version control system. To obtain them, just type the following command:

$ svn export http://source.ggy.bris.ac.uk/subversion-open/intro-to-linux/trunk intro-to-linux

The dollar sign "$" is caled the shell prompt, you do not need to type it in. It is merely there to show that the shell is waiting for a command.

This will fetch all necessary files and put them in a folder called intro-to-linux/. Ignore the cryptic syntax so far, an introduction to version control using subversion (svn) will be given later on.

Navigation

To change directories (folders), the command cd is used. It stands for ... "change directory" (!) To navigate to the directory folder containing the file, type:

$ cd intro-to-linux

By doing this operation, you used a relative path. Indeed intro-to-linux is not the full directory location but merely its relative path from where you were before. To find out the absolute path of you current location, use the command pwd (print working directory):

$ pwd
/gsa13/ggjpr/intro-to-linux

Obviously, the full path will depend on where your home directory is located. The absolute path starts at / called the root and then lists the branches of the directory tree leading to the current directory. Note that the directories are separated by slashes "/" and not backslashes as used by DOS in Microsoft Windows.


Creating/deleting/modifying