Introduction to UNIX - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to UNIX

Description:

Introduction to UNIX * * * * * * * * * * * Introduction to UNIX * Introduction What is UNIX? UNIX is an operating system which was first developed in the 1960s, and ... – PowerPoint PPT presentation

Number of Views:220
Avg rating:3.0/5.0
Slides: 22
Provided by: Autho284
Category:

less

Transcript and Presenter's Notes

Title: Introduction to UNIX


1
Introduction to UNIX
2
Introduction
  • What is UNIX?
  • UNIX is an operating system which was first
    developed in the 1960s, and has been under
    constant development ever since. By operating
    system, we mean the suite of programs which make
    the computer work. It is a stable, multi-user,
    multi-tasking system for servers, desktops and
    laptops.
  • UNIX systems also have a graphical user interface
    (GUI) similar to Microsoft Windows which provides
    an easy to use environment. However, knowledge of
    UNIX is required for operations which aren't
    covered by a graphical program, or for when there
    is no windows interface available, for example,
    in a telnet session.
  • Types of UNIX
  • There are many different versions of UNIX,
    although they share common similarities. The most
    popular varieties of UNIX are Sun Solaris,
    GNU/Linux, and MacOS X. .

3
The UNIX Operating System
  • The UNIX operating system is made up of three
    parts the kernel, the shell and the programs.
  • The kernel
  • The kernel of UNIX is the hub of the operating
    system
  • It allocates time and memory to programs and
    handles the filestore and communications in
    response to system calls.
  • An illustration of the way that the shell and the
    kernel work together
  • suppose a user types rm myfile (which has the
    effect of removing the file myfile)
  • The shell searches the filestore for the file
    containing the program rm, and then requests the
    kernel, through system calls, to execute the
    program rm on myfile
  • When the process rm myfile has finished running,
    the shell then returns the UNIX prompt to the
    user, indicating that it is waiting for further
    commands.

4
The UNIX Operating System
  • The shell
  • The shell acts as an interface between the user
    and the kernel.
  • When a user logs in, the login program checks the
    username and password, and then starts another
    program called the shell.
  • The shell is a command line interpreter (CLI) -
    it interprets the commands the user types in and
    arranges for them to be carried out.
  • The commands are themselves programs when they
    terminate, the shell gives the user another
    prompt ( on our systems).
  • The adept user can customize his/her own shell,
    and users can use different shells on the same
    machine.
  • History - The shell keeps a list of the commands
    you have typed in. If you need to repeat a
    command, use the cursor keys to scroll up and
    down the list or type history for a list of
    previous commands.

5
Files and processes
  • Everything in UNIX is either a file or a process.
  • A process is an executing program identified by a
    unique PID (process identifier).
  • A file is a collection of data. They are created
    by users using text editors, running compilers
    etc.
  • Examples of files
  • a document (report, essay etc.)
  • the text of a program written in some high-level
    programming language
  • instructions comprehensible directly to the
    machine and incomprehensible to a casual user,
    for example, a collection of binary digits (an
    executable or binary file)
  • a directory, containing information about its
    contents, which may be a mixture of other
    directories (subdirectories) and ordinary files.

6
The Directory Structure
  • All the files are grouped together in the
    directory structure. The file-system is arranged
    in a hierarchical structure, like an inverted
    tree. The top of the hierarchy is traditionally
    called root (written as a slash / )

7
The Directory Structure
In the diagram below, the home directory of the
undergraduate student "ee51vn" contains two
sub-directories (docs and pics) and a file called
report.doc. The full path to the file report.doc
is "/home/its/ug1/ee51vn/report.doc"
8
UNIX at BC SSH Secure Shell Client
  • The preferred connection method is SSH (Secure
    Shell Client) which does not transmit your
    password in the clear across the internet, as
    telnet and ftp do.
  • SSH includes sftp ( Secure File Transfer Protocol
    ) and scp ( Secure Copy ). See the Andersen
    textbook for more details.
  • If you are running a Linux, Unix or Mac system,
    ssh is probably available on your system.
  • For MS windows users install packages are
    available at
  • http//acc4.its.brooklyn.cuny.edu/sysadm/ssh/win
    /SSHSecureShellClient-3.2.9.exe
  • http//acc6.its.brooklyn.cuny.edu/sysadm/ssh/win
    /SSHSecureShellClient-3.2.9.exe
  • ftp//acc5.its.brooklyn.cuny.edu/pub/sysadm/SSHSec
    ureShellClient-3.2.9.exe
  • These Windows products are licensed for use by
    Brooklyn College only.
  • Using one of the lab's Unix machines, the command
    "lab_machines" will return a list of available
    Unix machines. i.e.
  • atrium11.its.brooklyn.cuny.edu 146.245.252.11atri
    um12.its.brooklyn.cuny.edu 146.245.252120acc2.its
    .brooklyn.cuny.edu 146.245.252.72
    fldsun228.its.brooklyn.cuny.edu 146.245.252.228

9
UNIX at BC - SSH
  • Once SSH is installed, click on the icon and SSH
    Secure Shell (left) will appear
  • Click on the Quick Connect icon this will
    bring up the Connect to Remote Host popup
  • Enter the Host Name (e.g., atrium96.its.brooklyn.c
    uny.edu) and User Name and click Connect
  • You will be prompted for your password
  • Another popup will allow you to name the profile
    information for future reference

10
UNIX at BC - SSH
  • Now youre connected at ready to roll

11
UNIX at BC SSH Transfer
  • To transfer files between your local PC and the
    Unix machines, click on the SSH Secure File
    Transfer icon
  • Click on Quick Connect and follow the same
    procedure as in connecting with SSH Shell
  • You will have two windows one for your local
    machine and one for the Unix server. Drag and
    drop files from one to the other

12
UNIX at BC - Telnet
  • Open a browser and enter the url
    telnet//atrium4.its.brooklyn.cuny.edu/
  • This will open a DOS window, connect you to the
    colleges SUN servers and prompt you for an id
    and password
  • When completed, you will see a prompt of the form
    atrium4/users1/rudowskygt
  • Now youre in business

13
UNIX at BC
  • See David Arnows Getting Started with UNIX
    guide
  • Basic commands
  • ls -a-l List files in the directory
  • mkdir ltdir namegt make a directory
  • rm ltfilenamegt remove a file
  • mv ltoldfilenamegt ltnewfilenamegt rename a file
  • cat ltfilenamegt display a file
  • cp ltoriginal_filenamegt ltcopy_filenamegt copy a
    file
  • command gt ltoutput_filenamegt redirect the output
    of a command e.g., ls l gt list
  • g xyz.cpp o xyz compiles a C program named
    xyz.c and saves the compiled progam as xyz
  • exit

14
UNIX at BC
  • ls does not, in fact, cause all the files in your
    home directory to be listed, but only those ones
    whose name does not begin with a dot (.)
  • Files beginning with a dot (.) are known as
    hidden files and usually contain important
    program configuration information. They are
    hidden because you should not change them unless
    you are very familiar with UNIX!!!
  • To list all files in your home directory
    including those whose names begin with a dot,
    type ls -a

15
UNIX at BC
  • When you type ls -a in a directory, two special
    directories called (.) and (..) appear
  • In UNIX, (.) means the current directory, so
    typing cd . means stay where you are
  • NOTE there is a space between cd and the dot
  • (..) means the parent of the current directory,
    so typing cd .. will take you one directory up
    the hierarchy
  • Note typing cd with no argument always returns
    you to your home directory. This is very useful
    if you are lost in the file system.
  • Pathnames enable you to work out where you are in
    relation to the whole file-system.
  • For example, to find out the absolute pathname of
    your home-directory, type cd to get back to your
    home-directory and then type pwd
  • pwd (print working directory)

16
UNIX at BC
  • Home directories can also be referred to by the
    tilde character. It can be used to specify
    paths starting at your home directory.
  • ls /unixstuff will list the contents of your
    unixstuff directory, no matter where you
    currently are in the file system
  • ls will list the contents of your home
    directory no matter where you currently are in
    the file system
  • ls /.. will list the contents of the parent of
    your home directory no matter where you
    currently are in the file system

17
Your Directory Structure
  • Your assignments should be maintained in a
    directory tree with the following structure
  • Directly beneath your home directory, there
    should be a subdirectory named cis15.
  • Directly beneath cis15, there should be a
    subdirectory named homework
  • Within homework, there should be a subdirectory
    for each assignment.
  • Thus, your files for homework 3 will be in the
    directory home/cis15/homework/hw-3 (where home is
    your home directory
  • Put all C code, input and output files in that
    directory. Subdirectories can be created as
    needed.

18
Formatting Your Code
  • Please use proper indentation-- reading code is
    like reading and essay-- improperly indented code
    is like text without punctuation, capitalization,
    and the other conventions of proper writing. You
    must develop the habit of proper indentation.
  • Please give some thought to your identifier and
    function names-- single letters such as i or x
    are fine for loop/array indexes or symbols in a
    mathematical equation, but beyond that, the
    variables should be names reflecting the
    data/function they hold/perform.
  • The first line of output from your program should
    contain your name, Unix id, course number and
    homework number.
  • Each source file you submit should have a comment
    at the top containing the same information as
    above plus the name of the file. For example
  • / Ira Rudowsky /
  • / rudowsky /
  • / CIS 15 EM6 Spring 07 /
  • / Assignment hw-1 /
  • / hw-1.cpp /

19
C IDEs
  • One way to work on your assignments is to code
    and debug on your local machine using an IDE
    (Dec/C http//www.bloodshed.net/devcpp.html
    or CodeBlocks http//www.codeblocks.org are
    two possibilities) and then transfer you code to
    the Atrium servers. (SSH Secure File Transfer or
    Core FTP LE http//www.coreftp.com/download.html
    and selecting the SSH/SFTP option.
  • To edit files on the Unix server, two possible
    editors are vi or pico (shows you useful commands
    in the editor window). The Andersen book explains
    both or you can Google tutorials for either
    editor and find numerous sources of information
    online.
  • The Unix compiler is invoked by the g command
    (see below for more).

20
UNIX at BC
  • Most of the machines are running Solaris 9, the
    rest Solaris 8.
  • The GUIs available are Sun's openwin, CDE and
    gnome.
  • Both gcc and sun's compilers are available. Only
    the command line compilers are usually used.
  • cc and CC are the front ends to Sun's C and C
    compilers. gcc and g are the front ends to
    gcc's C and C compilers.
  • cc  -flags  or CC -flags prints available
    compiler options
  • Use an editor to write the code, save the file 
    e.g., abc.c
  • g test1.cpp -o test1 produces file test1 if
    there are no errors
  • Run the program by its name test1 
  • The default output name is a.out is you omit the
    o option.

21
UNIX at BC
  • A lot of information regarding the Unix servers
    can be found at http//acc6.its.brooklyn.cuny.edu/
    AtriumSunGuide/Table_of_Contents.html
  • This includes
  • General Information
  • Unix Commands
  • Korn Shell
  • Regular Expressions
  • Floppies, Mtools
  • Tar
  • Editing Vi, Pico
  • Compilers, Debuggers
  • OpenWindows
  • Email, Pine, Talk
  • MailTool
  • Browsers Netscape, Lynx
  • Gopher
  • NewsReaders Trn, Xrn
  • NcFtp
  • Rules
Write a Comment
User Comments (0)
About PowerShow.com