[LINUX] I need the command for each of these steps. Make sure you write the comm
ID: 3718343 • Letter: #
Question
[LINUX]
I need the command for each of these steps. Make sure you write the command in bold.
Step 3: You can use the cat utility to create a file in your current directory. For example, "Hello World!", the content of MyFile, is created as follows:
$cat>MyFile
Hello World!
CTRL-D
Now you need to use the cat utility to create Sam's chapter files in your home directory from the information provided here:
Step 5: Create a file in your home directory named ChapterList that lists the names of the first three chapters in your home directory.
Step 7: To review how the chapters of Sam’s novel flow together, create a file named Novel that is a concatenation of the three chapter files. Display the contents of the Novel file on your screen to ensure that it successfully contains the text of all three chapters.
-----------------------------------------------------------
Step 3: Ensure that you have the Novel file, which was created in the previous assignments, in your home directory by listing the contents of the directory. Instruct the shell to open the Novel file so you can view the contents.
Step 4: Once you have viewed the contents of the file with the shell, open the Novel file with the visual editor using the vi or vim command. Do the contents of the file appear to be the same as when opened by the shell? Note your results in the answer sheet.
Step 5: Navigate through the Novel file by using the direction key that moves the cursor down one line at a time. Which two keys are available for moving down through the file one line at a time? Note your results in the answer sheet above.
Step 6: Navigate in each direction through the file by using all of the direction keys available to you. List the keys and their associated directions in the answer sheet above.
Step 7: Enter the command that instructs the visual editor to search through the Novel file, then locate and move the cursor to the word the. Once you have located the first occurrence of the word the, locate the next, and every other occurrence thereafter.
Step 8: Enter the command that instructs the visual editor to search through the Novel file, then locate and move the cursor to the word rush. Instruct the vi editor to delete the words rush to in the sentence. If the word rush is not found in the Novel file, use the visual editor to add it to the file and repeat step 8.
Step 9: Navigate to the first line of text in the Novel file. Instruct the editor to delete the entire line of text. Instruct the vi editor to undo the previous change to the line of text.
Step 10: Save your edits to the Novel file and quit the visual editor. Confirm that you have exited the visual editor by issuing the dir command to the shell. Open the Novel file with the shell and view the contents of the file. Have your edits been saved?
Step 11: Type exit at the command line to save the script file you
Step 12: Save your answers.pdf and then submit it on Canvas.
Step 13: Log off the terminal.
Chapter Title Text Chapter_1 It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm. Chapter_2 Christina looked at her watch. He was late. Chapter_3 The sun was setting but Jake didn’t care.Explanation / Answer
NOTE: I have completed your assignment. Please check and let me know if you find any issues. I will revert back within 24 hours. thanks for your patience.
I need the command for each of these steps. Make sure you write the command in bold.
To record the entire commands type. Start with the below command which will save all your commands in a6_script file
Unix Terminal> script a6_script
Script started, output file is a6_script
Step 3: You can use the cat utility to create a file in your current directory. For example, "Hello World!", the content of MyFile, is created as follows:
$cat>MyFile
Hello World!
CTRL-D
Now you need to use the cat utility to create Sam's chapter files in your home directory from the information provided here:
Chapter Title Text
Chapter_1 It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm.
Chapter_2 Christina looked at her watch. He was late.
Chapter_3 The sun was setting but Jake didn’t care.
Step 5: Create a file in your home directory named ChapterList that lists the names of the first three chapters in your home directory.
Ans)
Unix Terminal> mkdir ChapterList
Unix Terminal> cd ChapterList/
Unix Terminal> ls -tlrh
Unix Terminal> cat>Chapter_1
It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm.
Unix Terminal> cat>Chapter_2
Christina looked at her watch. He was late.
Unix Terminal> cat>Chapter_3
The sun was setting but Jake didn’t care.
Unix Terminal> cat Chapter_1
It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm.
Unix Terminal> cat Chapter_2
Christina looked at her watch. He was late.
Unix Terminal> cat Chapter_3
The sun was setting but Jake didn’t care.
Explanation:
a) mkdir ChapterList
Creates a directory ChapterList
b) cd ChapterList/
changes to the directory ChapterList
c) cat>Chapter_1
will create a file Chapter_1 where we can add contents and save it by using ctrl+d. Similarly the same can be done for other chapter files
Step 7: To review how the chapters of Sam’s novel flow together, create a file named Novel that is a concatenation of the three chapter files. Display the contents of the Novel file on your screen to ensure that it successfully contains the text of all three chapters.
Ans)
Unix Terminal> cat Chapter_1 Chapter_2 Chapter_3 > Novel
Unix Terminal> cat Novel
It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm.
Christina looked at her watch. He was late.
The sun was setting but Jake didn’t care.
Explanation:
a) cat Chapter_1 Chapter_2 Chapter_3 > Novel
concatenates chapter files and redirect the contents of file to Novel
b) cat Novel
displays the content of file Novel
-----------------------------------------------------------
Step 3: Ensure that you have the Novel file, which was created in the previous assignments, in your home directory by listing the contents of the directory. Instruct the shell to open the Novel file so you can view the contents.
Ans)
Unix Terminal> mv Novel ..
Unix Terminal> cd ..
Explanation:
a) The Novel file is created in ChapterList directory. In order to have the same file in home directory we have to move to one level up which is home directory.
b) cd ..
will move to one directory up
Step 4: Once you have viewed the contents of the file with the shell, open the Novel file with the visual editor using the vi or vim command. Do the contents of the file appear to be the same as when opened by the shell? Note your results in the answer sheet.
Ans)
Unix Terminal> cat Novel
It was a dark and stormy night. Christina unsuccessfully tried to block out the sounds of the thunderstorm.
Christina looked at her watch. He was late.
The sun was setting but Jake didn’t care.
Unix Terminal> vi Novel
Explanation:
a) cat Novel
Will display the contents of file Novel
b) vi Novel
will open the file Novel in Vi Editor
Step 5: Navigate through the Novel file by using the direction key that moves the cursor down one line at a time. Which two keys are available for moving down through the file one line at a time? Note your results in the answer sheet above.
Explanation:
a) To navigate to cursor down one line at a time there are two keys available in vi command.
b) Once you enter the vi editor press j or down arrow key to move one line down at a time.
Step 6: Navigate in each direction through the file by using all of the direction keys available to you. List the keys and their associated directions in the answer sheet above.
Ans)
Explanation:
a) Below are the direction keys available in vi editor.
h move left one character
j move down one line
k move up one line
l move right one character
Step 7: Enter the command that instructs the visual editor to search through the Novel file, then locate and move the cursor to the word the. Once you have located the first occurrence of the word the, locate the next, and every other occurrence thereafter.
Ans)
Explanation:
a) To search for a word in vi editor we can use the / command
example: /was
it will search for the word was in vi editor
b) Press Esc key then press 'n'
It will continue the search for next occurrence of word searched. Like if you have searched for was using / command then to find next occurrence press 'n'.
Step 8: Enter the command that instructs the visual editor to search through the Novel file, then locate and move the cursor to the word rush. Instruct the vi editor to delete the words rush to in the sentence. If the word rush is not found in the Novel file, use the visual editor to add it to the file and repeat step 8.
Ans)
Explanation:
a) To delete word press Esc in vi editor
b) Then position the cursor at the beginning of the word and type dw
Step 9: Navigate to the first line of text in the Novel file. Instruct the editor to delete the entire line of text. Instruct the vi editor to undo the previous change to the line of text.
Ans)
Explanation:
a) Press Esc in vi editor
b) Move to first line of the line by using up arrow key or press Esc then type :0 which will move to first line
c) to delete a line press 'dd' command.
Step 10: Save your edits to the Novel file and quit the visual editor. Confirm that you have exited the visual editor by issuing the dir command to the shell. Open the Novel file with the shell and view the contents of the file. Have your edits been saved?
Ans)
Explanation:
a) Press Esc in vi editor
b) To save and quit the vi press :wq in vi editor where w stands for save and q for quit.
Step 11: Type exit at the command line to save the script file you
Ans)
Explanation:
a) Once you exit from vi editor. type 'exit' in the unix prompt which will save all the commands typed in a6_script file.
Script done, file is a6_script
Step 12: Save your answers.pdf and then submit it on Canvas.
Step 13: Log off the terminal.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.