81.6k views
5 votes
Create a File: Demonstrate your ability to utilize a Linux command to create a text file. Create this file in the workspace directory: in. A text file showing the current month, day, and time (Title thisfile Time_File.txt.) II. Create a Directory: In this section of your project, you will demonstrate your ability to execute Linux commands to organize the Linux directory structure. a. In the workspace directory, create a new directory titledCOPY. III. Modify and Copy: Demonstrate your ability to utilize Linux commands to copy a file to a different directory and renameit. a. Copy the Time_File.txt file from the workspace directory to the COPYdirectory. b. Append the word COPY to the filename. IV. Execute the Script: Complete and execute the newly created script.

User Icke
by
6.0k points

1 Answer

4 votes

Answer: Provided in the explanation section

Step-by-step explanation:

#So we Create a workspace directory

mkdir workspace

#let us browse inside the workspace

cd workspace/

#creating a Time_File.txt file

touch Time_File.txt

#confirming creation of Time_File.txt

ls

# Time_File.txt

#writing in the month day and time to Time_File.txt

date +%A%B%R >> Time_File.txt

#Let us confirm the content of Time_File.txt as month day and time

cat Time_File.txt

# ThursdayJune19:37

#making a COPY directory

mkdir COPY

#verifying creation of COPY

ls

# COPY Time_File.txt

# copying Time_File.txt to COPY

cp Time_File.txt COPY/

#check the inside COPY

cd COPY/

#verifying copying of Time_File.txt to COPY

ls

# Time_File.txt

#appending COPY to Time_File.txt name

mv Time_File.txt COPYTime_File.txt

#confirming append

ls

# COPYTime_File.txt

# Creating a NewScript.sh

touch NewScript.sh

# cocnfirming the function

ls

# COPYTime_File.txt NewScript.sh

# adding executable permission

chmod +x NewScript.sh

ls

COPYTime_File.txt NewScript.sh

# Running NewScript.sh

./NewScript.sh

# Time_File.txt

# ThursdayJune19:49

# COPY Time_File.txt

# Time_File.txt

# COPYTime_File.txt

# we repeat same as seen above using script

ls

# COPYTime_File.txt NewScript.sh workspace

User GokulnathP
by
6.9k points