Using Ubuntu Command line. Please list out the commands and also provide the “sc
ID: 3742149 • Letter: U
Question
Using Ubuntu Command line. Please list out the commands and also provide the “script” command to record the whole session input/output.
Instruction Professor Karam is preparing his teaching materials for the new semester. He needs to re- organize the directories and files a bit. Please help him to complete the following tasks in the command line environment. Use the "script" command to record the whole session input/output to a file named "it4423-(your email id).txt". Note: practice and write down the process first and make sure you don't make any mistakes during the recording process 1. Figure 1 shows the current directory structure. Rectangular boxes are directories and ovals are text files. Create a directory structure as shown in Figure 1 in your personal or home folder (directory) as a starting point. Perform a serial of file and directory operations to arrive a structure as shown in Figure 2. Use the most efficient commands (as few as possible) to accomplish this - hint: do not use too many "cd" commands 2. 3. After you have finished, list all files and sub-directories (at all levels) in the IT4423-(your id)" directory using the "tree" command (you may have to install the tree command, the system will tell you how). Take a screenshot of your desktop with the terminal open the result should be clearly seen. Verify the structure is the same as in Figure 2. Note File "Test1" is renamed to "Midterm"; "Final" is a another copy of "Test1'" File "plan" and "lab" are the same in "Week1" and "Week2". File "Syllabus-template" is a copy of "Syllabus" File "Syllabus" in "Week1" is a link to "Syllabus" in "Fall 2012" The top level directory name should be "IT4423-(your email id)" ("jzheng" is an example id) Make other reasonable assumptions if necessary. But clearly state your assumptions in the document.Explanation / Answer
First of all we would set the directory structure specified in the question on my desktop. Then we need to execute linux command as specified to obtain the desried directory structure
root@kali:~/Desktop# script email.txt
Script started, file is email.txt
root@kali:~/Desktop# mkdir it4423
root@kali:~/Desktop# cd it4423
root@kali:~/Desktop/it4423# touch syllabus.txt
root@kali:~/Desktop/it4423# mkdir Fall2011
root@kali:~/Desktop/it4423# mkdir Spring2011
root@kali:~/Desktop/it4423# cd Spring2011/
root@kali:~/Desktop/it4423/Spring2011# mkdir Exams
root@kali:~/Desktop/it4423/Spring2011# cd Exams/
root@kali:~/Desktop/it4423/Spring2011/Exams# touch Test1.txt
root@kali:~/Desktop/it4423/Spring2011/Exams# cd ..
root@kali:~/Desktop/it4423/Spring2011# cd ..
root@kali:~/Desktop/it4423# ls
Fall2011 Spring2011 syllabus.txt
root@kali:~/Desktop/it4423# cd Fall2011/
root@kali:~/Desktop/it4423/Fall2011# mkdir exams
root@kali:~/Desktop/it4423/Fall2011# mkdir lectures
root@kali:~/Desktop/it4423/Fall2011# cd lectures/
root@kali:~/Desktop/it4423/Fall2011/lectures# mkdir Week1
root@kali:~/Desktop/it4423/Fall2011/lectures# cd Week1/
root@kali:~/Desktop/it4423/Fall2011/lectures/Week1# touch lap.txt
root@kali:~/Desktop/it4423/Fall2011/lectures/Week1# touch plan.txt
root@kali:~/Desktop/it4423/Fall2011/lectures/Week1# ls
lap.txt plan.txt
root@kali:~/Desktop/it4423/Fall2011/lectures/Week1# cd ..
root@kali:~/Desktop/it4423/Fall2011/lectures# cd ..
root@kali:~/Desktop/it4423/Fall2011# cd exams/
root@kali:~/Desktop/it4423/Fall2011/exams# touch guide.txt
root@kali:~/Desktop/it4423/Fall2011/exams# touch Test1.txt
root@kali:~/Desktop/it4423/Fall2011/exams# mkdir library
root@kali:~/Desktop/it4423/Fall2011/exams# ls
guide.txt library Test1.txt
root@kali:~/Desktop/it4423/Fall2011/exams#
root@kali:~/Desktop# ls
email.txt it4423
root@kali:~/Desktop# cd it4423/
root@kali:~/Desktop/it4423# ls
Fall2011 Spring2011
root@kali:~/Desktop/it4423# cd Fall2011/
root@kali:~/Desktop/it4423/Fall2011# cd Exams/
root@kali:~/Desktop/it4423/Fall2011/Exams# ls
guide.txt Library Test1.txt
root@kali:~/Desktop/it4423/Fall2011/Exams# cp Test1.txt Final.txt
root@kali:~/Desktop/it4423/Fall2011/Exams# mv Test1.txt Midterm.txt
root@kali:~/Desktop/it4423/Fall2011/Exams# cd ..
root@kali:~/Desktop/it4423/Fall2011# cd ..
root@kali:~/Desktop/it4423# ls
Fall2011 Spring2011
root@kali:~/Desktop/it4423# touch syllabus.txt
root@kali:~/Desktop/it4423# ls
Fall2011 Spring2011 syllabus.txt
root@kali:~/Desktop/it4423# cp syllabus.txt syllabustemplate.txt
root@kali:~/Desktop/it4423# ls
Fall2011 Spring2011 syllabustemplate.txt syllabus.txt
root@kali:~/Desktop/it4423# cd Fall2011/
root@kali:~/Desktop/it4423/Fall2011# cd Lectures/Week1/
root@kali:~/Desktop/it4423/Fall2011/Lectures/Week1# ls
lab.txt plan.txt Syllabus.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures/Week1# cd ..
root@kali:~/Desktop/it4423/Fall2011/Lectures# mkdir Week2
root@kali:~/Desktop/it4423/Fall2011/Lectures# ls
Week1 Week2
root@kali:~/Desktop/it4423/Fall2011/Lectures# cp Week1/plan.txt plan.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures# cp Week1/lab.txt lab.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures# ls
lab.txt plan.txt Week1 Week2
root@kali:~/Desktop/it4423/Fall2011/Lectures# mv lab.txt Week2/lab.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures# mv plan.txt Week2/plan.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures# ls
Week1 Week2
root@kali:~/Desktop/it4423/Fall2011/Lectures# cd Week2
root@kali:~/Desktop/it4423/Fall2011/Lectures/Week2# ls
lab.txt plan.txt
root@kali:~/Desktop/it4423/Fall2011/Lectures/Week2# cd ..
root@kali:~/Desktop/it4423/Fall2011/Lectures# cd ..
root@kali:~/Desktop/it4423/Fall2011# cd ..
root@kali:~/Desktop/it4423# mv Fall2011 Fall2012
root@kali:~/Desktop/it4423# ln syllabus.txt Fall2012/Lectures/Week1/Syllabus.txt
root@kali:~/Desktop/it4423# cd ..
root@kali:~/Desktop# mv it4423 it4423-jheng
root@kali:~/Desktop# ls
email.txt it4423-jheng
I couldn't install tree on my system. But you can use tree command to view the directory structure as
root@kali:~/Desktop# tree
this will show you final directory tree
you will get the script in email.txt
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.