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

1. Investigate the use of various UNIX commands. What do each of the following c

ID: 3913009 • Letter: 1

Question

1.       Investigate the use of various UNIX commands. What do each of the following commands do? (Explain the full meaning of each command in English; don’t supply the computer output of the command when you try it out.) Assume that names like file1 and file2 refer to files, and that Dir1 refers to a directory.

a.          cd ..

b.          ls Dir1               

c.          cat ~/file1

d.          cat file1 >> file2

e.          rm Dir1/file1

f.           cp file1 File1

g.          mv file1 File1

h.          mv file1 Dir1

2.       Investigate the history command in csh.

a.          Explain what each of the following three commands would do:

!45

!hi

!!

b.          What command must you type to list the last 15 commands you used?

3.       Investigate the vi editor. Briefly answer the following:

a.          Describe 12 different ways to move the cursor around in a file (e.g. h to move left one character).

b.          Describe 3 different ways to save a file that you are editing.

c.          If vi is in command mode, what do the following keys do?

o             O             A             J     

4.       Give one or two sentence descriptions of each of the following UNIX commands, and supply a screenshot for each one to show the command in action.

cal           finger        last          users         who

5.       For each of the following, describe what UNIX command (or series of commands) you would have to enter in order to perform the required operation:

a.          Create a duplicate of a file called doc1.

b.          Rename the file doc1 to be asst1.

c.          Make two backup copies of a file called file1. You can choose appropriate names for the backups.

d.          Display the file permissions of the contents of the root directory.

e.          Delete all the files in a directory called dir1, but do not delete the directory itself.

f.           Show the user names of the users who are currently logged in.

g.          Find the full name of the user who appears first in the list from (e).

6.       The C shell enables you to have several jobs loaded at the same time. Jobs can be running in the foreground, running in the background, or suspended. Do some research to answer the following questions:

a.          Which of the three types of jobs is/are being actively executed as opposed to being paused?

b.          Describe how to start a job as a background process using the & symbol.

c.          Explain what each of the following job control commands does:

bg            fg            jobs          kill          ps

Explanation / Answer

1)

a) cd .. - The change Directory command as the name says changes the directory. Now cd .. moves you up one directory. eg: if you are in the /usr/chegg/cs it will move you to /usr/chegg.

b) ls Dir1 - ls stands for list. ls Dir1 lists all the files present in the directory Dir1.

c) cat ~/file1 - This displays the contents in the file file1 .

d) cat file1 >> file2 - This adds the contents present in file1 to the end of file2.

e) rm Dir1/file1 - deletes the file1 present in Dir1.

f) cp file1 File1 - This command makes a replica of file1 and names it File1.

g) mv file1 File1 - This changes the file name to File1 from file1.

h) mv file1 Dir1 - This copies the file file1 and moves the copy to the directory Dir1.