CT320: Network and System Administration

Fall 2019

HW 1

CT320 HW1: Playing with Linux

This homework assignment needs to be performed individually on the Linux boxes in the Linux Lab, not on the machines in CSB 315.                 

The purpose of this assignment is to introduce you to (or remind you of) Linux commands that you may use on the Linux boxes.                 

Some of these questions may require commands or options that were not covered in lecture. To find out more about a command, use man. For example: man cat. To find out which manual pages mention a given topic: man -k topic | more.                 

Some of the questions may require a pipeline: command1 | command2                 

Don’t use command substitution: `command` or $(command)                 

Output Format

You will turn in a plain text file called hw1.txt, formatted thus:                 

1)
date

2)
this is where the answer for question #2 goes
if question #2 needs another line, it goes here

3)

and so on                 

Creativity is a wonderful thing, in its place. Creative formatting will not be appreciated. Follow the format, above. Create the file however you like. I’d use an editor.                 

Tasks

For all of these tasks, I do not want you to do the computing yourself. For example, if I ask how many files are in a given directory, I don’t want you to stare at the screen and count the files yourself, on your fingers. I want the computer to do the counting.                 

For these questions, I define items to be plain files, directories, symlinks, etc. It means things in a directory, no matter their type. The special directories . and .. are not included.                 

  1. Log on to any of the computers in the Linux Lab.
    What is the command to show the current time & date?
    Note that I am not asking for the current time & date in the answer file. Instead, I’m asking for the command.
  2. What is the command to show the name of this system?
  3. What is the name of this system?
  4. What command would show the lines in /etc/hosts that contain the letters “b”, “e”, “a”, “g”, “l”, “e”, in that order, possibly with other things between them?
  5. What command(s) would you use to count how many items are in /bin? Think of it in steps:
    • Generate a list of items in /bin. (Remember what items means.)
    • Now, count the number of lines in that listing.
  6. How many items are in /bin? How many items are in /usr/bin?
  7. Explain the relationship between the previous two numbers. Don’t just state the relationship—tell me why it is so.
  8. What command would show the home directory of user ct320? I’m not interested in the items it contains—I want the path of the home directory itself.
  9. What command would produce a listing of all forty-five of the items in the bin directory inside ct320's home directory, in reverse alphabetical order? I want the command to show 45 items, none of which should be the . or .. directories.
  10. Show a complete bash script, using only shell variables and built-in shell constructs (no other programs such as expr or bc) to display the final sum of the numbers 1 through 789, inclusive. Do not use algebra to figure out the sum. Make the computer actually do all seven hundred eighty-nine additions. You must follow the recommendations in the Bash scripts lecture.

Debugging

If you encounter “STACK FRAME LINK OVERFLOW”, then try this:

    export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a

How to Submit

Use web checkin, or use Linux checkin to submit your hw1.txt, like this:                 

    ~ct320/bin/checkin HW1 hw1.txt

How to Receive Negative Points

Turn in someone else’s work