COMP3000 Operating Systems W22: Tutorial 1

From Soma-notes
Revision as of 00:59, 3 January 2022 by Lianyingzhao (talk | contribs) (Created page with "In this first tutorial you will be learning the basics of command-line interaction in Linux (Ubuntu) and how to find out information about the OS environment. When source file...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In this first tutorial you will be learning the basics of command-line interaction in Linux (Ubuntu) and how to find out information about the OS environment. When source files are needed, you can download them by clicking on the hyperlink.

Tutorials are graded based on participation and effort (so no need to try to have the “correct” answers — what matters is the process), but you should still turn in your work. Submit your answers on Brightspace as a single text file named "<username>-comp3000-t1.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Tutorial 1", your name, student number, and the date of submission.

The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.

You should also check in with your assigned TA online (by responding to the poll in the private Teams channel). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session.

You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.

Getting Started

Tasks/Questions

  1. When you have first logged in to a shell, how (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).
    • The version of your Linux distribution and the version of your Linux kernel.
    • RAM, remaining/total disk space, and CPU.
    • The name (binary path) of the current shell.
  2. Using the man command, find out what the following commands do: which, pwd, who, whoami, and whereis.
  3. Linux commands can be classified as internal (built into the shell) and external (separate program binaries). How can you tell if a specific command (e.g., cd) is internal or external? Figure out where at least three external commands reside on the system.
  4. Making your own commands: the PATH environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways.
  5. Look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?
  6. For those same program binaries, figure out what the permission bits mean by reading the man page of chmod (this is the command you could use to change those permission bits).
  7. What are the owner, group, and permissions of /etc/passwd and /etc/shadow? What are these files used for (and how did you find this out)?
  8. What does it mean to have execute permission on a directory?
  9. The ls command can be used to get a listing of the files in a directory. What options are passed to ls to see: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?
  10. Compile and run csimpleshell.c. How does its functionality compare to that of bash? List at least 3 differences.