(c) Saverio Perugini, Winter 2005, University of Dayton. Permission to use ideas about the organization of topics and any notes or material is granted, provided suitable acknowledgments and citations are made.

UNIX

(personalized for UD CPS and CPE students and Solaris 10)
    Accessing your UNIX account
    Logging in and out of your UNIX account
    Changing your password
    Changing your login shell
    Transferring files to and from your UNIX account
    Compilers and interpreters
    Browsing the web
    Reading a PDF file
    References and tutorials
    Books
    System tools
    System support references

Accessing your UNIX account

You can access your UNIX account from one of the following two ways:
  1. By sitting directly in front of the UNIX computer you are trying to access. The UNIX computers in our department, called Suns, live in the AN 131 lab. This simply involves entering your username and password (given on the first day of class) at the console. Be sure to change your password (see instructions below).

  2. By accessing the UNIX computer remotely from another (UNIX, Windows, Apple) computer using SSH (Secure SHell).

    1. SSH is a common protocol for connecting to remote computers. There are several free versions of SSH available. My personal favorite is PuTTY. The Windows computers in the CPS labs (AN 13[15] and MH 21A) are equip with SSH Secure Shell (Start -> Programs -> SSH Secure Shell -> Secure Shell Client).

    2. You may connect to any of the following ten computers identified by their hostname:

        sun131-13.cps.udayton.edu
        sun131-21.cps.udayton.edu
        sun131-22.cps.udayton.edu
        sun131-23.cps.udayton.edu
        sun131-31.cps.udayton.edu
        sun131-32.cps.udayton.edu
        sun131-33.cps.udayton.edu
        sun131-41.cps.udayton.edu
        sun131-42.cps.udayton.edu
        sun131-43.cps.udayton.edu

      Note: You can access your files from any of these computers.

  3. After you connect, enter your username and password (given on the first day of class; if you have never logged into one of these computers, your password is still the default as it is not synchronized with your Windows account). You will see a command prompt for input.

Logging in and out of your UNIX account

To log in, follow the above instructions for
accessing you account. Enter your username when prompted. Similarly, enter your password when prompted.

To log out, hit crtl-d (this is the EOF character on UNIX systems).

Changing your password

    To change your password, enter the following command at the prompt.
    passwd <LOGNAME>
    
    where <LOGNAME> is your login name (e.g., cps444-n1.01 or cps544-n1.01).

Changing your login shell

    To change your login shell (e.g., to bash), enter the following command at the prompt.
    passwd -r nis -e <LOGNAME>
    
    where <LOGNAME> is your login name (e.g., cps444-n1.01 or cps544-n1.01).

    The path to the Bash shell (Bourne Again SHell) is /bin/bash. The path to the Korn shell is /bin/ksh. The shell is the user's command line interface to the UNIX system. The Bash and Korn shells have more user friendly features, such as command and filename completion (using the TAB key), than the C shell (i.e., csh, the default login shell for your account).

Transferring files to and from your UNIX account

In order to transfer files to and from your account, you need a secure file transfer program. There are several free versions of SCP (Secure CoPy) and SFTP (Secure File Transfer Protocol). From the
PuTTY Download Page and you can download PSCP or PSFTP. The Windows computers in the CPS labs (AN 13[15] and MH 21A) are equip with Secure File Transfer Client (Start -> Programs -> SSH Secure Shell -> Secure Shell File Transfer Client).

Compilers and interpreters

  • C: gcc mypgm.c
  • C++: g++ mypgm.cpp
  • Perl: perl mypgm.pl
  • Python: python mypgm.py
  • ML: sml mypgm.sml


Compiling a C program in UNIX

  • use gcc (gNU c compiler; GNU = Gnu is Not Unix)
  • gcc traverse.c (compiles and links; produces executable a.out)
  • gcc -o traverse traverse.c (produced executable traverse)


GNU C and C++ Compiler


  • to compile a C program use gcc
  • to compile a C++ program use g++
  • examples:
      $ gcc -c parser.c
      $ gcc -g -c parser.c
        compiles, but does not link, parser.c;
        produces object file parser.o
      $ gcc parser.c
        compiles and links parser.c;
        produces executable a.out
      $ gcc parser.c main.o
        compiles and links parser.c with main.o;
        produces executable a.out
      $ gcc -o parse parser.c main.o
        compiles and links parser.c with main.o;
        produces executable parse


More on compiling with gcc

  • gcc -I <dir to add to search path for include files> (searched before the standard system include directories)
  • gcc -l<abbrev>
    • explicitly links library corresponding to the library abbreviation following the -l
    • e.g., gcc -lm calc.c (link against the math library)
  • gcc -L <dir to add to search path for libraries> (those searched for -l)
  • g++ (GNU C++ compiler) works the same way

Browsing the web

To fire the Mozilla web browser, enter the following command (only from the console): mozilla &

Reading a PDF file

To read a PDF file, enter the following command (only from the console): acroread [filename] &

References and tutorials

(also have a look at the posters titled "UNIX Shell Commands" and "UNIX Vi Commands" in the AN 131 lab)

Books

Pick up any textbook or programming reference on UNIX at the Roesch Library or your local library. My favorites are the following.
  1. B.W. Kernighan and R. Pike. The UNIX Programming Environment. Prentice Hall, Second edition, 1984. ISBN: 0-13-937681-X.
  2. A. Robbins. UNIX in a Nutshell: A Desktop Quick Reference for GNU/Linux, Mac OS X, and Solaris. O'Reilly, Fourth edition, 1999. ISBN: 0596100299.
  3. M. G. Sobell. A Practical Guide to the UNIX System. Addison Wesley, Third edition, 1994. ISBN: 0-8053-7565-1.
  4. L. Lamb and A. Robbins. Learning the vi Editor. O'Reilly, Sixth edition, 1998. ISBN: 1-56592-426-6.
  5. S. Powers, J. Peek, T. O'Reilly, and M. Loukides. UNIX Power Tools. O'Reilly, Third edition, 2002. ISBN: 0596003307.

System tools

XLiveCD (a free CD based on Cygwin for X Windows forwarding via ssh)

System support references



Return Home