COMP2718 Lab 1 - An Introduction

Please answer each question in the space provided. If the space is not enough, then use the back of the sheet. You must submit your lab exercises at the end of the lab with your name and student number.

Setting up your GitLab account

Before starting you must have an account on GitLab. You should already have received an invitation to join a project called https://gitlab.com/COMP2718/lab1_USERNAME.git. Please check your MUN e-mail and accept this invitation and proceed to create your free GitLab account.

Course git repo

In a terminal window, enter the following:

% cd /tmp
% git clone https://gitlab.com/COMP2718/2718_lab1.git
% cd 2718_lab1

Using some or all of the following commands cd, ls, and pwd, determine the following, also state the commands used:

  1. The absolute path name of the current directory.
    Command(s):

    Output:
  2. The size in bytes for README and assign1 (the directory itself, not its contents).
    Command(s):

    Output:

Assignment git repos

In a terminal window, enter the following:

% cd /tmp && rm -rf myweb # delete only if cd worked
% mkdir myweb
% cd myweb
% echo "<html><body>HI</body></html>" > hi.html
% git init # creates a git repo
% git status
% git add hi.html
% git commit -m "lab 1 start"
% git log
% git remote add origin https://gitlab.com/COMP2718/lab1_USERNAME.git
% git push --all origin -u
# requires your password

NOTE: You must replace "USERNAME" above with your Memorial University username.

A git repo with one file has been set up and copied to the remote repo. The following commands will change a file and push the change to the remote repo.

% sed s/HI/hi/ <hi.html > xx.html
% mv xx.html hi.html
% git add hi.html
% git commit -m "to lowercase"
% git push
# requires your password
% git log

Use a web browser (e.g. Firefox) to view the remote repository at https://gitlab.com/COMP2718/lab1_USERNAME.git.

You should also verify that the remote repository has been updated appropriately through the command line:

% cd /tmp
% git clone https://gitlab.com/COMP2718/lab1_USERNAME.git
% cd lab1_USERNAME

How can the ls -lR command be used to provide a check (the check will be incomplete) that the directories /tmp/myweb and /tmp/lab1_USERNAME contain the same informaton.

Relative and absolute path names

Consider the following two directories which we will refer to as [1] and [2], respectively:

  1. Using the absolute path name, what cd command would set the current directory to [1].
  2. Using a relative path name, what cd command would change into the [2] directory (assuming the working directory is set by the previous command).
  3. Using a relative path name, what cd command would change back into the [1] directory.
  4. Is there any advange to using the relative path names in the above examples?

Using ls, file, less, man

Change in to the /usr/share/dict directory, and answer the following, state what command(s) you used.

  1. Determine the type of the files present.
  2. Execute man ls and look for information on the display of symbolic links. Identify any symbolic links in this directory.
  3. For any symbolic links, state the file referenced by the link. Use the file command to determine the type of file referenced.
  4. Using the less command, determine the last 3 lines of the words file. Use man less to find a quick way to go to the end of the file. State the way.
  5. How would you check to see if a line containing kumquat appeared in the words file using less? Consult the man page if necessary.