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

UBUNTU Basic Utilities and commands. Open your terminal and connect to snowball

ID: 3783161 • Letter: U

Question

UBUNTU

Basic Utilities and commands.

Open your terminal and connect to snowball server. Change your directory to your home directory (cd ~ ), and then create a new directory named as “PC2” (mkdir PC2). After that, go to directory PC2 (cd PC2) and please download a test file by the following command (internet access required):

cp /home/local/GSUAD/ylong4/PC2/CSC_Course.txt CSC_Course.txt

Be sure it succeeds using “ls” to see the file name “CSC_Course.txt” listed.

Then please write the commands you will issue to complete the following tasks step by step. And for question 10), please only provide some descriptions as an answer.

Note: You cannot use cd to change the working directory during the steps. Each task requires only one command.

ANSWER ALL QUESTIONS ON PAPER !!!

1) Use cat to display the content in "CSC_Course.txt".

2) Count only the lines in "CSC_Course.txt".

3) A. Open the manual page for command cat .

B. Go to next screen. Note: please read the descriptions for option s and n

C. Quit the manual page.

D. Display "CSC_Course.txt" again with line numbers.

E. Display "CSC_Course.txt" again while suppress repeated empty out lines.

F. Display "CSC_Course.txt" again with line numbers and suppress repeated empty out lines.

4) Output the first 15 lines of "CSC_Course.txt".

5) Output the last 15 lines of "CSC_Course.txt".

6) Display the absolute pathname for current working directory.

7) Use absolute pathname to rename "CSC_Course.txt" as "CSC_Course.bak" .

8) A. Create a new folder "Backup".

B. Copy “CSC_Course.bak” into this folder and give it a new name “CSC_Course.bak1” using relative pathname.

C. Check the existence of “CSC_Course.bak1” in folder "Backup" by using ls and relative pathname.

9) Display the long listing information for file " CSC_Course.bak" only.

10) What is the meaning for each bit in the file permission mode for file " CSC_Course.bak "? (Please provide some descriptions)

11)For file “CSC_Course.bak”, use chmod to add read and write permission for all without using octal number.

12) For file “CSC_Course.bak”, use chmod and octal number to set user only read permission, set group no permissions, and set other no permissions.

Explanation / Answer

1. cat CSC_Course.txt

2. wc -l CSC_Course.txt

3.

D) cat -n CSC_Course.txt

E) cat -s CSC_Course.txt

F) cat -ns CSC_Course.txt

4. head -n 15 CSC_Course.txt

5. tail -n 15 CSC_Course.txt

6. pwd

7. mv $PWD/CSC_Course.txt $PWD/CSC_Course.bak

8. A) mkdir backup

B) cp CSC_Course.bak backup/CSC_Course.bak1

C) ls backup/CSC_Course.bak1

9. ls -l CSC_Course.bak

10. bits are in three group (rwx, rwx, rwx). r means read, w means write, x means execute.

First group is for file owner. Second is for unix group and third id for all others.

11. chmod a+rw CSC_Course.bak

12. chmod 400 CSC_Course.bak