JUST NEED THE COMMANDS (Using terminal in Linux) Professor Karam is preparing hi
ID: 3882378 • Letter: J
Question
JUST NEED THE COMMANDS (Using terminal in Linux)
Professor Karam is preparing his teaching materials for the new semester. He needs to reorganize 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 mistake during the recording process.
a) 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.
b) 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.
c) After you have finished, list all files and sub-directories (at all levels) in the “IT4423-(your id)” directory using one command. 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.
Syllabus guide IT4423 Fall2011Exams library Test1 plan Lectures week,K-C-lab Spring2011-H Exams } Test1 Figure 1. Original StructureExplanation / Answer
Here is a series of commands(for linux terminal):
Note:
commands and their meanings-
mkdir- Make directory
cd- change directory
mv- move
cp- copy
ln- link
Type commands one by one as given below
1. For Orignal Structure:
Open terminal
By default you should be in your home directory
$ mkdir IT4423
$ cd IT4423
$ touch Syllabus.txt
$ cd ..
$ mkdir Fall2011
$ cd Fall2011
$ mkdir Exams
$ cd Exams
$ touch guide.txt
$ touch test1.txt
$ mkdir Library
$ cd ..
$ cd ..
$ mkdir Lectures
$ cd Lectures
$ mkdir Week1
$ cd Week1
$ touch plan.txt
$ touch lab.txt
$ cd /home/IT4423
$ mkdir Spring2011
$ cd Spring2011
$ mkdir Exams
$ cd Exams
$ touch Test1.txt
2.For Finished structure
$ mkdir IT4423-jzeng
$ cp /home/IT4423/* /home/IT4423-jzheng
$ mv Syllabus.txt Syllabus-template.txt
$ mv Fall2011 Fall2012
$ cd Fall2012
$ touch Syllabus
$ cd Library
$ cp /home/IT4423-jzheng/Fall2011/Exams/Test1.txt /home/IT4423-jzheng/Fall2012/Exams/Library/Midterm.txt
$ cp /home/IT4423-jzheng/Fall2011/Exams/Test1.txt /home/IT4423-jzheng/Fall2012/Exams/Library/Final.txt
$ cd /home/IT4423-jzheng/Fall2012/Lectures/Week1
$ touch Syllabus.txt
$ ln -s Syllabus.txt /home/IT4423-jzheng/Fall2012/Syllabus.txt
$ touch plan.txt
$ touch lab.txt
$ cd ..
$ mkdir Week2
$ touch plan.txt
$ cp /home/IT4423-jzheng/Fall2012/Lectures/Week1/plan.txt /home/IT4423-jzheng/Fall2012/Lectures/Week2/plan.txt
$ touch lab.txt
$ cp /home/IT4423-jzheng/Fall2012/Lectures/Week1/lab.txt /home/IT4423-jzheng/Fall2012/Lectures/Week2/lab.txt
To list of directories and files in tree :
Firstly install tree
$ yum install tree
$ sudo apt-get install tree
and then for orignal structure:
$ tree /home/IT4423
for final structure:
$ tree /home/IT4423-jzheng
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.