Lab03 - ICT310 Lab 3 Unix Shells Standard I\/O Redirections Archiving and Compressions C's Formatted Input and Output and Command Line Arguments Learning

Lab03 - ICT310 Lab 3 Unix Shells Standard I/O Redirections...

This preview shows page 1 - 4 out of 12 pages.

ICT310 Lab 3: Unix Shells, Standard I/O Redirections, Archiving and Compressions, C's Formatted Input and Output, and Command Line Arguments Learning Objectives: 1. Learn to use Unix shells, especially bash shell 2. Learn to do standard I/O redirections. 3. Learn to use command tar to archive files and to extract files from archives 4. Learn to use command gzip and gunzip to compress and uncompress files 5. Learn to use standard C functions for formatted output: printf , fprintf , and sprintf 6. Learn to use standard C functions for formatted input: scanf , fscanf , and sscanf . 7. Learn to use command line arguments from C programs. Required Reading: Lecture Notes for Topic 2 Rute: Ch 4.18, Ch 7.1, Ch 12, Ch 20.8 A mini manual for vi editor Access to Software: Internal students will use the lab machines on Murdoch Campus. You will need your Murdoch Username and Murdoch Password to log into your account on the lab machines. Once logged to the Windows account, you will need to use VMware virtual machine to run Ubuntu Linux. You should also bring a USB flash drive with you
Image of page 1
to the lab for copying your work from the virtual machine. For external students, if you have already installed Linux, then use your own Linux installation. If you have not yet installed your own Linux, you may use our Linux server (ceto.murdoch.edu.au) temporarily until you have installed the Linux on your machine (details see Lab 1). More information on how to install Linux is available from Download Page of this website. Unix Exercises The following exercises are designed to get you familiar with Unix (Linux) systems. More information about these basic Unix commands is available from the relevant chapters in Rute. See the Required Readings. 1. Unix Shells When you start up a terminal program, Unix runs a shell program automatically inside the terminal. The default shell for most Linux distributions is bash shell (/bin/bash). You can confirm this by typing the command ps to see the list of processes that are running on your login session, which should include bash. You can also start and stop a shell manually. For example, typing the command bash would start another bash shell process. You can exit from the shell by typing the command exit at its prompt. Now try to start a new shell. For example, bash or tcsh. Type the command ps -H to confirm that different (instances of) shells are running. Exit the shell by typing command exit . A shell is a command interpreter. It prints a shell prompt on your terminal, inviting you to enter a command. It then tries to locate the command and once located, creates a process to run that command.
Image of page 2
Note usually you do not need to manually start a shell. A shell is always run when you start a terminal application. 2. Shell Scripts Each Unix shell is like a programming language. You can write a shell script and run the shell script in a shell.
Image of page 3
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture