Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do all steps, this is UNIX. First, create a directory named cs3377 (if you do not have created it yet), and change directory to

Please do all steps, this is UNIX.

First, create a directory named cs3377 (if you do not have created it yet), and change directory to cs3377.

Task#1. Create a directory named a1part1. Use ls -l command to show the directory information of a1part1.

Then cd to this directory (a1part1).

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console output for this task only)

Task#2. Create all the files and directories as shown and explained below.

image text in transcribed

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console output for this task only)

Task#3. After creating each file and directory, let the content of each file be the output of "ls -l" command of the directory in which the file is created (for example, ls -l > file1.txt).

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console output for this task only)

Task#4. You will change the file attribute of each file as follows.

all the files (and subdirectories and files if any) in dir1 with rw- --- ---

all the files (and subdirectories and files if any) in dir2 with rwx rw- r-x

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console log for this task only)

Task#5. Read Sobell on ls command (pages 861-868).

And try ls commands shown below with a few options. Show your result of each command.

Your current working directory is a1part1. Note that you should use dash ("-") for command option(s) here.

ls l

ls lR

ls lRi

ls lR --si

ls lR --sort=time

ls lR --sort=size

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console output for this task only)

Task#6. You ade currently in the directory: a1part1. List all the files and subdirectories. Save its output to a1task6.txt:

ls R

ls R > a1task6.txt

cat a1task6.txt

Copy and paste the run-output of your work here (You may copy and paste mobaXterm console output for this task only)

Task #7. Write a bash shell script in cs3377 directory.

First (1), create a shell script (myScript1.sh) in cs3377 directory by: touch myScript1.sh

Second (2), change its file attribute to be executable: chmod a+x myScript1.sh

Third (3), edit this file with vi or vim

Fourth (4), insert the first line of the file to be: #!/bin/sh

Fifth (4), collect all the commands from Task#2 to Task#6, and insert each command to be one line in this file.

Make sure that you are in the right directory to execute each command as specified in each task.

For example, for task#6, you should have: cd a1task6 (before running ls R)

The script file will contain:

#!/bin/sh

mkdir a1part1

cd a1part1

mkdir dir1

cd dir1

touch file1.txt

Copy and paste your shell script here

Task#8. You are in cs3377 directory. First, remove (delete) a1part1 directory and all the files and its subdirectories recursively (with rm command). Show (ls R) that all the files and its subdirectories are deleted. List the directory information and also save the output to task8.txt.

rm r a1part1

ls R a1part1

ls R a1part1 > a1task8.txt

Copy and paste the output of Task#8 here

Task #8. Write a bash shell script (myScript2.sh) in cs3377 directory, to do what you did in Task#7 (to delete a1part1 directory and all files and subdirectories of a1part1 in cs3377).

Copy and paste your shell script (myShell2.sh) here

Task#9. run the myShell.sh file to recreate all the files and directories that you have done in Task#2 to Task#6.

List all the files and subdirectories and save its output to a file:

ls R

ls R > a1task9.txt

Copy and paste the output of Task#9.

As shown below, you will create a few subdirectories in your current directory, a few files, and a symbolic-link as shown below This is your current directory which is a1part(i c53377) dirl dir2 file3.txt linkl file1.txt file2.txt dirl1 filel .txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions