CSCI 3215 (Advanced UNIX Command-Line Tools), Fall 2022:
Homework 1

Credit:
40 points.

Reading

Be sure you have read, or at least skimmed, the assigned readings for 8/29, 8/31, 9/14, 9/19, and 9/21.

Problems

Answer the following questions. You may write out your answers by hand and scan them, or you may use a word processor or other program, but please turn in a PDF or plain text file. (No links to shared files on Google Drive please, and no word-processor files.) Turn it in by putting it in your course “TurnIn” folder on Google Drive. Please be sure to include your name somewhere in the file, so when I print it for grading I know whose work it is. (With the pledge is fine.)

Files and filesystem basics

(These arguably should have been in Reading Quiz 1.)

  1. (5 points) On one of the lab machines, the command ls -l /bin/vi produces the following output:

    -rwxr-xr-x 1 root root 1180368 Aug 2 02:47 /bin/vi

    What does all of this mean? (I.e., what does the string of dashes and letters mean? The 1? The large number? and so on.)

    (Hint: man ls and info ls may be helpful.)

  2. (5 points) What command(s) would you use to create a directory in your home directory called KeepOut to which you have full access (read, write, and execute), but no one else has any access?

Processes and job control

(These arguably should have been in Reading Quiz 1.)

  1. (5 points) Suppose you have started a GUI application called bigpig that for some reason doesn't seem to be responding to any input. How do you terminate it without logging out or rebooting the machine? Describe as many ways as you can think of.

    (Hint: man ps and man kill.)

Shell basics and customizations

(Answer the following questions for the bash shell.)

  1. (5 points) Give the command(s) you would use to define two aliases or shell functions: delete to move a file to be “deleted” to a temporary directory such as $HOME/.trash, and undelete to move a “deleted” file from the temporary directory to the current directory. (Examples of use: delete myfile, undelete otherfile.)

    (It's up to you to decide whether these should be aliases or shell functions. Hint: You might be constrained by the capabilities of aliases versus functions.)

    Note that commands to define aliases or functions can be entered from the command line, in which case they apply to the current session only, or can be included in an appropriate initialization file.

I/O redirection and pipes

(These arguably should have been in Reading Quiz 2.)

  1. (5 points)

    How would you invoke the gcc compiler if you want to be able to page through its output (both standard output and standard error) with less?

    How would you capture the error output only in a file called gcc-ERRORS?

  2. (5 points) How could you make a one-line text file without using a text editor? Could you extend this idea to make a multiline text file? Tell me about as many ways to do this as you can think of.

Using pipes and filters

  1. (5 points) What would you type at the command line to get a sorted list, with no duplicates, of all the users running processes on the machine you're using, along with a count of processes they're running?

  2. (5 points) Answer/do one of the following:

    1. What would you type at the command line to find out how many processes are being run by user root?

    2. Describe something you actually want to do (e.g., archive all files that have been changed in the last 24 hours, or find a classroom machine that's up and connect to it with ssh) and a solution involving a pipe and at least one of the commands mentioned in the reading for this assignment.

Pledge

This should include the Honor Code pledge, or just the word “pledged”, plus at least one of the following about collaboration and help (as many as apply). Text in italics is explanatory or something for you to fill in; you don't need to repeat it!

Essay

This should be a brief essay (a sentence or two is fine, though you can write as much as you like) telling me what if anything you think you learned from the assignment, and what if anything you found interesting, difficult, or otherwise noteworthy.




2022-09-28