Python脚本代写 | MSDM5001: homework1


Install a Linux operating system distribution on your computer. A vir-
tual machine or a Windows subsystem is recommended. You may also use
Amazon or Google cloud computing.

1. Open a terminal, run the command “top”, and save a screenshot in
your report.

2. Use a few Linux commands to collect the hardware information of your
computer to draw the memory hierarchy diagram (see Lecture 1). List
the used commands and brie y explain what they are used for.

3. Install the Linux \tree” command if your Linux system does not have
it, e.g., sudo apt install tree. Run the commands
cd /bin; tree j head -n 20

Paste the output into your report and brie y explain what these com-
mands did.

Write a bash script to create 200 directories/folders, whose names are
\MSDM1, MSDM2, MSDM3, …, MSDM200″. In each directory, generate a
text file, \time till now.txt”, in which the content is
nanoseconds since 1970-01-01 00:00:00 UTC:
The digits in <> should be calculated when you execute the script. (Hint:
you may use the Linux command \date”. The same command in ma-
cOS/UNIX may not work.)

Write bash or python scripts to get the desired data from the \block-
list.xml” file. You should simply print the whole lines.

1. Print all the text lines with the \blockID” values that start with the
letter \i” or \p”, and end with digits, e.g., `<emItem blockID=\i334″
id=\f0F827075-B026-42F3-885D-98981EE7B1AEg”>’. (Tip: In the xml
file, \blockID” is the attribute name and \i334″ is the attribute value.)

2. Print all the text lines where the \id” values are email addresses ending
with \.com”. Skip the email addresses that are written by regular
expressions containing special characters, such as \n, /, ^ “.