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

Please write the commands you will issue to complete the following tasks step by

ID: 3663680 • Letter: P

Question

Please write the commands you will issue to complete the following tasks step by step on a word document.

Part A Assuming the following directory structure.

To establish this directory structure, please copy the following commands one by one.

mkdir CSc3320 CSc3320/hw2 CSc3320/hw2/folder1 hw2 file1 folder1 folder2 folder3 file2 CSc3320

The initial location of all following questions is here:

mkdir CSc3320/hw2/folder2 CSc3320/hw2/folder1/folder3

touch CSc3320/hw2/file1 CSc3320/hw2/folder1/file2

Now, enter the CSc3320 folder by cd CSc3320 , then answer following questions. The initial location of all questions is inside the CSc3320 folders.

1. Go to folder3 folder.

2. Output current pathname.

3. List all files and directories under folder1.

4. Create folder4 under folder2.

5. Remove file2.

6. Remove all files and folders under CSc3320 folder.

Part B

Download hw2-partb.txt file from my website by following command wget http://grid.cs.gsu.edu/~bli6/teaching/spring2016/hw2-partb.txt 1.

Open the manual page for command cat.

2. Use cat to display the content in hw2-partb.txt.

3. Count characters, words,lines in hw2-partb.txt.

4. What is the different between cat and more commands?

5. Output the first 10 lines of hw2-partb.txt.

6. Output the last 10 lines of hw2-partb.txt.

7. Change the file permissions of hw2-partb.txt to - -x - w - r- -, assuming the current permission is r - - r - - - - - Use vim editor for following questions.

8. Use vim to open hw2-partb.txt.

9. Move the cursor to line 20.

10.Move the cursor to the end of current line.

11.Delete the current line.

12.Copy all lines between line 35 and 40 to the end of file.

13.Search the string “grep”.

14.Save the file and quit vim.

Explanation / Answer

PART-A

1. Go to folder3 folder.

cd hw2/folder1/folder3/

2. Output current pathname.

pwd

3. List all files and directories under folder1.

cd hw2/folder1/

ls -lhrt

4. Create folder4 under folder2.

cd hw2/folder2

mkdir folder4

5. Remove file2.

cd hw2/folder1

rm file2

PART-B

1. Open the manual page for command cat

man cat

2. Use cat to display the content in hw2-partb.txt.

cat hw2-partb.txt

3. Count characters, words,lines in hw2-partb.txt.

wc hw2-partb.txt

output of above command shows number of lines, words and characters

4. What is the different between cat and more commands?

cat is a standard Unix utility that reads files sequentially, writing them to standard output

5. Output the first 10 lines of hw2-partb.txt.

head -10 hw2-partb.txt

6. Output the last 10 lines of hw2-partb.txt.

tail -10 hw2-partb.txt

7. Change the file permissions of hw2-partb.txt to - -x - w - r- -, assuming the current permission is r - - r - - - - - Use vim editor for following questions.

use chmod command

8. Use vim to open hw2-partb.txt.

vim hw2-partb.txt

9. Move the cursor to line 20.

j and k move down and up one line, so 20j and 20k move down and up ten lines

10.Move the cursor to the end of current line.

shift +G

11.Delete the current line.

dd

12.Copy all lines between line 35 and 40 to the end of file.

13.Search the string “grep”.

grep 'grep' file_name

14.Save the file and quit vim.

:wq!