Assignment #2 - Practicing with Emacs and VI, and Permissions

Due: FRIDAY, JUNE 17, 11:59:59PM

Objective

To practice with the basics and more of the text editors, emacs and vi, as well as practice with setting file permissions.

Requirements

  • Use your CS login to help you answer these questions. Write or paste answers in a text file (like you did for assignment 1 -- same format). Any other type of file WILL NOT BE ACCEPTED.
  • While these questions on the editors can easily be looked up, it is recommended that you actually OPEN emacs and vi for those questions and try these commands out yourself, to get a feel for these two text editors. Try these commands on a text file that has some text inside of it - not just on an empty text file. This will help you on the test, and in future CS courses, especially if you choose to specialize in utilizing one of these editors.

  • Questions

    
    Question 1 (10 points)
    Write the keystrokes needed for the commands in vi if the editor is currently in "Command" mode.
    a. Delete 4 lines, starting from the current line.
    b. Search "dog" or "Dog" in the entire document
    c. Delete 6 characters, starting from the current position
    d. Switch to "insert" mode.
    e. Undo the most recent command.
    
    Question 2 (10 points)
    Briefly explain what the given command would do in vi if the editor is currently in command mode. (Hint: Go try these commands 
    and verify what they do).
    a. :wq!
    b. :%s/dog/Dog/g
    c. 2fa
    d. yy (Hint: after doing this, go elsewhere in the file and do the command p)
    e. gg
    
    Question 3 (10 points)
    Write the keystrokes needed for these commands in editor emacs. Assume that you want to accomplish each task with as few 
    keystrokes as possible.
    a. Search backward
    b. Cut text from the "mark" to the current position
    c. Move to the end of the line
    d. Move forward one page
    e. Save buffered text to currently specified file
    
    Question 4 (10 points)
    Briefly explain what each of the given commands would do in editor emacs. Note that the ^ symbol in these commands represents 
    the Control key.
    a. ^x u
    b. ^b
    c. ^y
    d. ^x ^c
    e. ^s
    
    Question 5 (10 points)
    For questions a and b, write out two different ways (using numerical and letter methods) to change the permissions of the file 
    "thing.txt" to the permissions specified.
    
    a. User has read, execute permissions, group has read permissions, other has write and execute permissions
    b. User has no permissions, group has read write execute permissions, other has write permissions
    c. What are the default permissions of a newly created text file?
    d. What are the default permissions of a newly created directory? WHY does it differ from the permissions of a new text file? 
    Name one command that would not produce the desired result when a directory that is not executable is used as a parameter to 
    the command.
    

    Format of the Assignment:

    The submitted assignment document is expected to be in plain text format in a single file, named this way:
    assign2_lastname_firstname.txt where you substitute your own last name and first name in the filename, in the format above. For instance, my file would be assign2_vastola_melina.txt
    The assignment file should be formatted as follows:
    COP3353 - Spring 2016
    Assignment 2 Solution - Due Date Here
    Name: Your Name
    
    Question 1 (10 points):
    ----------------------------------------------------------------------------
    Your Solution
    
    Question 2 (10 points):
    ----------------------------------------------------------------------------
    Your solution 
    (etc) ...
    

    Submitting

    Make sure you are logged into linprog.cs.fsu.edu and the file you want to submit is stored in your current working directory.
    To submit, type the following command:
    ~vastola/usub/submit2 yourFilename
    where you substitute your filename above as the parameter. Example -- if my file is called assign1_vastola_melina.txt, I would type:
    ~vastola/usub/submit2 assign1_vastola_melina.txt
    This will run a script and a C++ program that copies your file into a submission directory. The program will also give you feedback at the end -- it will display the contents of the file you just submitted to standard output. This will allow you to check to make sure that what you submitted was correct.