ICT310 Lab 3: Unix Shells, Standard I/O Redirections, Archiving and Compressions, C's Formatted Input and Output, and Command Line ArgumentsLearning Objectives:1.Learn to use Unix shells, especially bash shell2.Learn to do standard I/O redirections.3.Learn to use commandtarto archive files and to extract files from archives4.Learn to use commandgzipandgunzipto compress and uncompress files5.Learn to use standard C functions for formatted output:printf,fprintf, andsprintf6.Learn to use standard C functions for formatted input:scanf,fscanf, andsscanf.7.Learn to use command line arguments from C programs.Required Reading:Lecture Notes for Topic 2Rute: Ch 4.18, Ch 7.1, Ch 12, Ch 20.8Amini manualfor vi editorAccess 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 willneed to use VMware virtual machine to run Ubuntu Linux. You should also bring a USB flash drive with you
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 ExercisesThe following exercises are designed to get you familiar with Unix (Linux) systems. More information about thesebasic Unix commands is available from the relevant chapters in Rute. See the Required Readings.1. Unix ShellsWhen 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 commandpsto 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 commandbashwould start another bash shell process. You can exit from the shell by typing the commandexitat its prompt.Now try to start a new shell. For example, bash or tcsh. Type the commandps -Hto confirm that different (instances of) shells are running. Exit the shell by typing commandexit.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.
Note usually you do not need to manually start a shell. A shell is always run when you start a terminal application.2. Shell ScriptsEach Unix shell is like a programming language. You can write a shell script and run the shell script in a shell.