Orientation for fresh vdtt students introduction to unix
This presentation is the property of its rightful owner.
Sponsored Links
1 / 34

Orientation for fresh VDTT Students Introduction to UNIX PowerPoint PPT Presentation


  • 92 Views
  • Uploaded on
  • Presentation posted in: General

Orientation for fresh VDTT Students Introduction to UNIX. July 28, 2001. Anup Gangwar. Overview. Prerequisites and goals of this course Differences between UNIX and Windows Overview of unices Basic UNIX commands and utilities Lunch Break File editors in UNIX

Download Presentation

Orientation for fresh VDTT Students Introduction to UNIX

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Orientation for fresh vdtt students introduction to unix

Orientation for fresh VDTT StudentsIntroduction to UNIX

July 28, 2001

Anup Gangwar


Orientation for fresh vdtt students introduction to unix

Overview

  • Prerequisites and goals of this course

  • Differences between UNIX and Windows

  • Overview of unices

  • Basic UNIX commands and utilities

  • Lunch Break

  • File editors in UNIX

  • Programming and Shell Scripting

  • Document formatting using UNIX

  • References and further study

  • Thank You


Orientation for fresh vdtt students introduction to unix

Prerequisites and Goals

  • What you should know

    • Basic familiarity with computers

    • Working Knowledge of atleast one operating system

    • A will to learn

  • What you will know

    • This is not a complete UNIX tutorial

    • Don’t try to learn the whole UNIX in one day

    • How to do the most common set of tasks with UNIX

    • Self-Help is the best help

    • Pointers for further information


Orientation for fresh vdtt students introduction to unix

Differences: UNIX and Windows

  • The UNIX and Windows philosophies

  • Client-Server model of Computation

  • Multi-User and Multi-Tasking. Login?

  • Concept of the Kernel and User Shell

  • Concept of file ownership and groups

  • GUI on UNIX and X windows

  • Tips:

    • UNIX is the most used OS in scientific and industrial community

    • Instead of avoiding UNIX take it heads on

    • Learning UNIX now will help you save precious time later on


Orientation for fresh vdtt students introduction to unix

Overview of Unices-1

  • The ?original? UNIX

  • The AT&T SVR and BSD

  • Others: HP-UX, Solaris, Linux, AIX, IRIX etc.

  • Why are there so many unices? Vendor Wars!

  • How do I understand all of them? POSIX!

  • Tips:

    • Learn the common set of commands for all the unices

    • Linux utilities will contain enhancements not found in others

    • Try to clear trivial doubts like command syntax yourself


Orientation for fresh vdtt students introduction to unix

Overview of Unices-2

  • HP-UX

    • Processors: HP PA-RISC and Intel Itanium

    • Vendors: HP

    • Markets: High End Servers and Workstations

  • Solaris/SunOS

    • Processors: Sun Ultra Sparc

    • Vendors: Sun Microsystems

    • Markets: All ranges of Servers and Workstations


Orientation for fresh vdtt students introduction to unix

Overview of Unices-3

  • Linux/GNU Systems

    • Processors: Intel 386 and up, Sun Ultra Sparc, IBM PowerPC etc.

    • Vendors: Free/GNU GPL

    • Markets: Low End Servers and Workstations

  • AIX (Advanced UNIX)

    • Processors: IBM Power PC

    • Vendors: IBM

    • Markets: All ranges of Servers and Workstations


Orientation for fresh vdtt students introduction to unix

Overview of Unices-4

  • IRIX

    • Processors: MIPS

    • Vendors: SGI (Silicon Graphics International)

    • Markets: High End Graphics Servers and Workstations

  • Others

    • BeOS, FreeBSD etc.

    • RTOS’s: PSoS, QNX, RTEMS, ?RTLinux? etc.


Orientation for fresh vdtt students introduction to unix

What we have

  • Philips VLSI Design Lab

    • HP Server running HP-UX

    • Sun Workstation

    • Linux Workstations

  • VDTT Lab

    • Linux Workstations

    • Windows NT Workstations

  • New VLSI Lab

    • Sun Workstations

    • Windows NT Workstations


Orientation for fresh vdtt students introduction to unix

Basic UNIX Commands and Utilities-1

  • Files and Directories

    • File Types: Windows and UNIX

    • File and Directory creation (Editors, mkdir, ln etc.)

    • Listing contents of a directory (ls)

    • File and Directory deletion (rmdir, rm etc.)

    • File and Directory permissions (chmod)

    • File and Directory ownership (chown, chgrp)

    • Organizing your work in directories (mv)

  • Tips:

    • UNIX doesn’t have a recycle bin!

    • Try not to make the mistake of rm -rf * command


Orientation for fresh vdtt students introduction to unix

Basic UNIX Commands and Utilities-2

  • Managing your account

    • What is meant by managing your account?

    • Concept of setup files

    • Why are there so many different Shells?

    • Environment variables

    • .bashrc and .cshrc files

    • Customizing your environment with .bashrc and .cshrc files

    • Example: The TERM environment variable and stty

    • Tips:

      • Try an environment variable on command-line first

      • Always set the PATH variable properly


Orientation for fresh vdtt students introduction to unix

Basic UNIX Commands and Utilities-3

  • Remote process execution

    • Why do we need remote process execution?

    • Telnet and rlogin

    • Remote execution of graphics programs

      • X-Security, granting permissions and colormap

      • The DISPLAY environment variable

    • dot-rhosts (.rhosts), xon

    • Moving files between computers: FTP (?anonymous? FTP login)

    • Tips:

      • Graphics performance suffers in remote graphics execution

      • xhost+ is the worst thing to do!

      • Ncftp is a better ftp client than the vanilla default UNIX ftp


Orientation for fresh vdtt students introduction to unix

Basic UNIX Commands and Utilities-4

  • Taking printouts

    • Concept of network and local printers

    • Printer languages: Postscript and PCL

    • GhostView and Acroread programs

    • Spooling, Deleting and Checking a printer job

    • Duplex printing and mpage

  • Taking backups

    • Tarring, zipping, gzipping and compressing

    • Comparison with winzip and common filename extensions

  • Tips:

    • Do not issue the command tar -cvf <file-name> *

    • Acroread just might be a better program to open pdf files


Orientation for fresh vdtt students introduction to unix

Basic UNIX Commands and Utilities-5

  • Miscellaneous stuff

    • Forcing a process in background (&, fg, bg)

    • Setting aliases

    • Online manual pages, man

    • Concept of NIS and NFS

    • Changing password, passwd (?yppasswd?)

    • Searching for patterns, grep and regular expressions

    • Working with files with special characters in names

    • The file utility

    • finger, who and rwho

    • ps and kill

    • Mailand mail clients, netscape, pine, emacs and mail

    • startx, .Xclients and .xinitrc files

  • Tips:

    • Instead of asking someone try man -k

    • It is a good practice to stick to one shell (csh is available on all)


Lunch break

Lunch Break


Orientation for fresh vdtt students introduction to unix

Editors in UNIX-1

  • What all is available, Vi, Emacs, Pico, Joe?, Nedit?

  • Vi: The king of all editors? Tutorial?

    • Why learn vi?

    • Getting in and out?

    • Basic keys for editing

      • Moving around, deleting, joining lines

      • Repeating commands

      • Search and replace

    • Tips:

      • Vim is not Vi

      • Learn the keypad scroll key combinations instead of arrow keys

      • Vi is fast, try to make the best use of its capabilities


Orientation for fresh vdtt students introduction to unix

Editors in UNIX-2

  • Emacs: Much more than an editor?

    • Why learn Emacs? History, Tutorial

    • Getting in and out?

    • Basic keys for editing

      • Moving around, deleting a line

      • Search and replace

      • Formatted text, postscript spooling

      • mail in emacs

    • Syntax highlighting and templates

    • Tips:

      • Emacs recognizes 20+ languages out of the box

      • Emacs is slow

      • Emacs is not available by default on all unices


Orientation for fresh vdtt students introduction to unix

Editors in UNIX-3

  • Pico: Is there really a need?

    • Pico and Pine

    • Editor Keys

  • Joe?, Nedit?

    • Keys similar to Norton Editor

    • Nedit has some features similar to Emacs

  • Tips:

    • Don’t fall for Pico or Nedit

    • Learn Vi and Emacs if you really want to get into UNIX

    • In the end it is a matter of choice


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-1

  • Is programming on UNIX tough? What all is available?

  • Concept of IDE and differences with TurboC++

  • Compilers, Linkers, Debuggers and front-ends

  • Managing big projects: make and comparison with TC project file

  • Example of a simple makefile

  • GUI development on UNIX

  • Java

  • Tips:

    • UNIX is a programmers paradise


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-2

  • Gcc, The GNU C/C++ compiler

    • Simplest possible way to use: gcc <file-name>

    • Common options

      • output filename: -o

      • compile only: -c

      • Warnings: -Wall

      • optimizations: -O{1,2,3,4}

      • Debug: -g

      • Linking: -l<library-name>

    • Tips:

      • Not every UNIX systems will have gcc

      • Turning on optimization makes the compilation slow

      • Debugging and optimizing donot go together


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-3

  • Ld, The Linker

    • What exactly are libraries?

    • Shared and static libraries

    • Is there a need to call Ld explicitly?

    • Passing options to Ld from gcc

      • The -l option

      • The -L option

      • The LD_LIBRARY_PATH environment variable

      • The LD_RUN_PATH environment variable

    • Tips:

      • Always check the Ld on the system, HP-UX doesn’t use GNU Ld

      • Environment variables are different with non GNU Ld


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-4

  • Gdb, The GNU C/C++ debugger

    • Why is a debugger needed?

    • gdb and ?core? File

    • Common commands

      • list

      • run, break, resume

      • backtrace and where

    • Tips:

      • Using gdb directly might be tedious

      • Try the various front-ends to gdb: emacs, xxgdb, mxgdb etc.

      • Not every system will have gdb, you just might have to use ?dbx?


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-5

  • Gmake or GNU make

  • What is the need for a Makefile?

    • Dependencies

    • Targets in a makefile

    • Patterns in makefile

    • Automatic variables in a makefile

    • Pattern substitution

    • Common target names: all, clean, docs

  • Tips:

    • Never forget the TAB

    • Make is language independent!


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-6

  • Example of a makefile

    CC=gcc

    COPTS= -g -Wall

    TARGET=run.x

    SRCS=hello.c junk.c

    OBJS=$(SRCS:.c=.o)

    all:$(OBJS)

    $(CC) $(COPTS) $(OBJS) -o $(TARGET)

    clean:

    rm -f $(OBJS) core

    %.o:%.c

    $(CC) $(COPTS) -c $<


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-7

  • GUI in UNIX?

    • Differences with TurboC++

    • Vanilla X windows programming, why not?

    • TCL/Tk

    • Widget libraries

      • Motif

      • GTK

      • QT, etc.

    • Tips:

      • Always provide a command line interface to your programs

      • Using a GUI is slow


Orientation for fresh vdtt students introduction to unix

Programming on UNIX-8

  • Java

    • What is really different with the windows version?

    • Is Jfc, Java2D, Java3D available?

    • IDE’s for Java over UNIX?

  • Tips:

    • Don’t try to use a %.class dependency with make

    • If you run Java from a server, graphics would be slow


Orientation for fresh vdtt students introduction to unix

Introduction to Shell Programming-1

  • What is the need for shell programming?

  • Bourne shell (sh, ksh, zsh and bash)

  • c shell (csh, tcsh)

  • Examples of shell programming

    • Moving all a.{i}.txt files to a.{i+1}.txt

    • Cleaning up your directory at the end of a day

  • Tips:

    • Perl just might be a better option

    • Don’t forget ?sed? and ?awk?


Orientation for fresh vdtt students introduction to unix

Introduction to Shell Programming-2

  • Moving files script

    #!/bin/sh -f

    FILE_LIST=`ls | grep "\.[0-9]\." `

    for CURR_FILE in $FILE_LIST; do

    FIRST_NM=`echo $CURR_FILE | cut -d'.' -f1`

    NUM=`echo $CURR_FILE | cut -d'.' -f2 `

    SECOND_NM=`echo $CURR_FILE | cut -d'.' -f3`

    NUM_PLUS=`expr $NUM + 1 `

    mv -i $CURR_FILE $FIRST_NM.$NUM_PLUS.$SECOND_NM

    done


Orientation for fresh vdtt students introduction to unix

Introduction to Shell Programming-3

  • Cleanup directory script

    #!/bin/csh -f

    # Assume that ps, pdf etc. directories are present

    set FILE_LIST=`ls`

    foreach CURR_FILE ( $FILE_LIST )

    set TST=`echo $CURR_FILE | grep \.pdf\$ `

    if( $TST != "" ) then

    mv $CURR_FILE pdf

    endif

    set TST=`echo $CURR_FILE | grep \.ps\$ `

    if( $TST != "" ) then

    mv $CURR_FILE ps

    endif

    end


Orientation for fresh vdtt students introduction to unix

Text formatting using UNIX-1

  • What is the need for text formatting?

  • WYSWYG or NOT?

  • LaTeX & Emacs PS renderer

  • LaTeX WYSWYG front-end Lyx

  • Other text formatters: ?troff?

  • How to make Presentations? Slides?

  • Tips:

    • PowerPoint is still the best software for making presentations

    • It is easy to convert PowerPoint slides to html


Orientation for fresh vdtt students introduction to unix

Text formatting using UNIX-2

  • LaTeX

    • origin: LaTeX and TeX

    • usage

    • LaTeX tutorials and manuals

      • A not so short introduction to LaTeX

      • The LaTeX manual

      • LaTeX by Lesslie Lamport

  • Lyx a WYSWIG interface to LaTeX

  • Emacs ps-renderer and troff

  • Tips:

    • For small formatted text Emacs is still the best


Orientation for fresh vdtt students introduction to unix

Before wrapping up

Any questions/doubts which you would like to clarify?


Orientation for fresh vdtt students introduction to unix

Wrapping up

  • Self help is the best help!

    • The UNIX man pages. ?Manual sections?

    • Using man, whatis etc.

    • Experiment. You can never kill the system.

  • Links

    • http://www.gnu.org, for GNU tools and manuals

    • http://sunsite.unc.edu, world’s largest collection of free software

    • http://upavan.cse.iitd.ernet.in, Philips Lab. internal page

    • http://poorvi.cse.iitd.ernet.in/local, Intel cluster archives

  • Books

    • The UNIX programming environment, Kernighan & Pike


Thank you

Thank You


  • Login