The University of Western Australia
Computer Science and Software Engineering
 
 

Department of Computer Science and Software Engineering

CITS4407 Open Source Tools and Scripting

Exercise sheet 1 - for the week commencing 2nd March 2020

These exercises are performed by entering commands to the bash command interpreter (or shell), an acronym for the Bourne-again shell, using the Terminal window application (under either Linux or macOS).

While Terminal provides a visible interface, supporting variations in fonts and colours, the 'real' work of executing our required commands is performed by bash.

bash indicates that its ready to accept a new command by issuing a prompt, we type our required command, press the Return (or Enter) key, and read the required command's output (if any). These exercises are very simple; they are not designed to provide a lot of take-away knowledge, but to overcome any hesitation you may have about controlling your computer through a character interface, rather than a graphical-user interface (GUI).

We commence our story assuming that you have logged into either Linux or macOS, and have started an Xterm or Terminal process....
Remember, that the man command is likely to be the first one you'll need.


  1. What is the current date and time on the computer you're using?

  2. On what day of the week is the last day of this month?

  3. On what day of the week is the last day of this year?

  4. Each instance of a bash process has a working directory - a location in the computer's file system where files may be read and created (by default).
    What is your shell's present working directory?
    As you have just started a new bash process, you're actually in your home directory, in and below which you can create, edit, and store all of your own files.

  5. What is the current date and time in London, which uses Coordinated Universal Time (UTC)?

  6. For this, and some following exercises, you may like to open the operating system's graphical file and directory browser Files (under Linux) or Finder (under macOS).
    We previously listed the working directory of the shell. Now, use the ls command (that's 'EL' 'S') to list any files and (sub)directories in that working directory.

  7. Next, use the mkdir command to make a new directory, named cits4407, in the present working directory. Did you notice a new icon appear in your graphical file browser?
    Use the ls command to 'ensure' that the new directory has been created in the present working directory, and then ls again (with an argument) to see that the new directory is empty.
    Navigate to this new directory using your graphical file browser.

  8. Now, change the shell's directory into your new directory named cits4407. Use ls again to see that it's (still) empty.

  9. Next, create a new file, named newfile, by executing touch in this cits4407 directory. Using the ls command to display a longer, detailed listing of the contents of the current directory.

  10. Now, touch the file newfile again. What attribute/property of the file has changed?

  11. OK, let's cleanup this temporary work we've done. Use the cd command to change back to your home directory. How do you know you're in the right place?
    OK, we've created a new directory named cits4407 and, in it, a new file named newfile. Your task is to remove both of them, so that your home directory is as it was at the start of these exercises.


Chris McDonald
February 2020.

This Page

Written by: [email protected]