Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Once you have successfully logged into the LMS it may look very different to what you are use too, particularly if you are use to using windows.  Please do not let this put you off.  The research computing team have successfully managed to help many people use these computers who have never used Linux command line before.  It takes a bit of getting use to but the more you use it the easier and quicker it will become over time.


The shell has been the major interface for the Unix/Linux operating system since it was first conceived. The shell allows interaction with the operating system through a text based interface. The shell provides the user with the following features:


  • An easy to use command line interface (CLI)
  • Combine existing tools to create new tools
  • Input/output redirection
  • Wildcard characters for filename abbreviation
  • Variables and options for environment customisation
  • Ability to write shell functions and programs
  • Command-line editing
  • Command history (quick access to previous commands)
  • Arithmetic
  • Command abbreviations


The user starts the shell by logging into the computer with a userid and password


Code Block
languagebash
titleLogging in
******************************************************************************
***                   THE UNIVERSITY OF YORK IT SERVICES                   ***
***                                                                        ***
***                       THIS IS A PRIVATE COMPUTER                       ***
***                UNAUTHORISED ACCESS STRICTLY PROHIBITED                 ***
******************************************************************************

login: user001
password: 
Last login: Mon Sep  8 14:12:44 2014 from gallifrey.york.ac.uk
-bash-4.1$



The last line is a command prompt and it is the means by which the computer is telling you that it is ready to accept a command from you. If you do not see the prompt, the computer is probability still executing the last command you have typed. The user types commands which take the form:


command [ options ] [ arguments ]


Options to a command are usually proceeded by a '-' or '- -', this differentiates them from the arguments. The following example shows the echo command which prints the arguments and the ls command which take options arguments. The ls command display the users file. There will be more explanation of files and the ls command later.


Exercise 2 - Running commands in the Linux shell

When you see the prompt type the following command.  You can also copy and paste the command into your terminal

Code Block
languagebash
echo I love York

What happens?  The terminal should write out "i love York".  The echo command is a small program that takes an input called a string, a series of characters and repeats them to the user.

Now try typing the following command.

Code Block
languagebash
ls
ls -l

What do you see? Something like this?

Code Block
languagebash
titleExmaple of command execution
-bash-4.1$ echo Hello World
Hello World
-bash-4.1$ ls
bin  Chemistry  Desktop  examples  Experiments  intel  jobs  logs  tmp
-bash-4.1$ ls -l
total 296
drwxr-xr-x 2 abs4 csrv        4096 Jun 24 09:39 bin
drwxr-xr-x 3 abs4 csrv        4096 Jun  6 09:23 Chemistry
drwxr-sr-x 2 abs4 elecclust   4096 Mar 11 10:53 Desktop
drwxr-xr-x 3 abs4 csrv        4096 Jun 30 12:21 examples
drwxr-xr-x 5 abs4 csrv        4096 May 23 11:34 Experiments
drwxr-xr-x 3 abs4 csrv        4096 Aug 14 12:26 intel
drwxr-sr-x 3 abs4 elecclust   4096 Aug 15 12:49 jobs
drwxr-xr-x 2 abs4 csrv      266240 Aug 15 13:48 logs
drwxr-xr-x 3 abs4 csrv        4096 Aug 14 14:50 tmp
-bash-4.1$ 

The ls command lists all of the files in your current directory. A directory is equivalent to a folder.  The ls -l command gives you more information about each file or folder such as who is the owner of the file, who can access it, when it was last accessed. You can use most linux commands in a number of ways by adding extra flags.  Here for ls -l we added the -l flag. If you need to know more about a command you can use either of the following


Code Block
languagebash
ls --help

or

man ls