Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

http://en.wikipedia.org/wiki/Vi For each of the following problems, use your uni

ID: 3562964 • Letter: H

Question

http://en.wikipedia.org/wiki/Vi

For each of the following problems, use your unix system to answer each of these questions. If it asks for output, then copy the output into the answer space. Be sure to answer ALL questions given.

1. What is the basic command for getting help? Give the command to get help for the help command.

2. From you Linux desktop, what is the name of the terminal application? How do you find the default shell for this terminal? What is your default shell?

3. Give two ways to show the contents of a text file.

4. For your default shell, where is the configuration file located? What is the name of this file? What is one thing you can change in the configuration file that might be useful?

5. There are two ways to change the access to a file using chmod. Give the command for chmod using both ways to give read/write access to the owner and group but to turn off all access to the "world".

6. What is the version of the kernel in your Linux installation? What is the command you use on the commandline to find this?

7. How do you determine how much diskspace is used on the your harddisk? How do you determine how much your home directory is using on the harddisk?

8. How do remove an empty directory? What if the directory contains files, how do you remove it then?

9. Suppose you need to find a file in your home directory by the name of "myfile.txt". Give the command to find this file only searching in your home directory. How would you find all files with the ".txt" extension in your home directory?

10. How do you rename a file? Can you rename a file to a different directory? Give a command for moving a file "myfile.txt" out of the "temp" subdirectory in your home directory into your home directory.

11. Unix has some special directory names. What are these names and what are they used for?

12. Suppose you want to search the contents of all files in the subdirectory "project" in your home directory. You want to look for the "printf" statement in all files. What command will you use?

13. How do you log into remote server? Show the command for this from your computer. (If you use an application like Putty, then describe setting up the "session" for logging onto the server.) How do you exit your login?

14. Most Linux implementations use the 'sudo' command to protect the administrator login. How is 'sudo' used to execute a privileged command? Where is the configuration file for 'sudo'? What is the line in the configuration file that gives you the right to use administrator privileges? Explain this line.

15. What are the modes of VI? Give the commands to move between these modes. What mode is used to move around in a text file? Give ALL the VI commands to move in a file.

16. How is a command repeated in VI?

17. In VI, how do you delete 5 lines to a buffer and then insert them at a different location from the buffer?

18. In VI, how do you jump to line number 100? to the beginning of the file? to the end of the file? Also, give the movement commands for character left, character right, line up, line down, line begin, line end, page down, and page up.

19. In VI, how can you search for the keyword 'printf'?

20. In VI, how do you load a file and save a file? What if you make changes to a file and want to exit without saving, how do you do this?

Explanation / Answer

MPCS 51081 is a UNIX systems programming course (as opposed to an operating systems course) that explores various topics in systems programming on the Unix platform. This course is NOT a course in operating systems development. We will focus on the Unix C APIs around file I/O, processes and signals, pipes, and System V interprocess communication.

In addition to the traditional systems programming topics, this course will also introduce students to a significant level of detail in the use of Sun RPC (Remote Procedure Calls) and multithreaded programming, including operating system support and models (1-1, many-1, many-many).   Students will be exposed to the numerous issues involved in safe and efficient multithreading strategies using the POSIX pThreads API as implemented by Linux's clone() and Solaris threads. Multithreading architectures will be discussed as well as advanced issues such as mutexes, semaphores, race conditions, deadlocks, etc. Berkeley socket programming will be covered in detail, as well as the creation and use of shared libraries.

Various tools used in developing software in C on Unix will be covered, including gcc, gdb, ddd, gprof, cvs, etc. Because this is a programming course, students will be expected to know the C programming language upon course entry. There will be a C programming qualifying test taken during the first week of class for all students.

Specific Learning Objectives include: