1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marina CMI [18]
3 years ago
9

1. Write a bash script to create 3 files of different size greater than 1700 kb and less than 1800 kb . The 2. Content of the fi

le must be text characters. File content generated by your script can be characters of your choice. 3. Archive the 3 files created into a single file using the TAR command. (Show command, Note file size) 4. Gzip each of the 3 files individually (note file size) 5. Gzip the TAR file created in step 2. (Note file size) 6. Place results from actions 3, 4, 5 in a readme file that you submit along with your script. Compression values noted in your readme file will be checked against files generated by your script, therefore your accuracy will be verified.
Computers and Technology
1 answer:
Mazyrski [523]3 years ago
4 0

Answer:

See explaination

Explanation:

Bash Script:

#!/bin/bash

echo "Creating files a.txt, b.txt, c.txt..."

#1

# Create a random number between 1700 to 1800. This is the Kb we are looking for

# And then multiply by 1000 (1Kb = 1000 bytes)

r=$(( ($RANDOM % 100 + 1700) * 1000 ))

# head -c specifies the number of chars to read from the input,

# which is /dev/urandom stream in this case.

# Ideally we should have just used r*1000 to specify number of bytes,

# but since we are pipelining it to base64 to get text chars,

# this conversion will happen in the ratio of 4/3.

head -c $r /dev/urandom | base64 > a.txt

# Hence, we trunctate the file to the exact (random number we generated * 1000) bytes

truncate -s $r a.txt

r=$(( ($RANDOM % 100 + 1700) * 1000 ));

head -c $r /dev/urandom | base64 > b.txt

truncate -s $r b.txt

r=$(( ($RANDOM % 100 + 1700) * 1000 ));

head -c $r /dev/urandom | base64 > c.txt

truncate -s $r c.txt

#3 Use tar command to create all_three.tar from a.txt, b.txt, c.txt

tar -cf all_three.tar a.txt b.txt c.txt

echo $(stat -c "%n: %s" all_three.tar)

#4 Gzip a.txt into a.gz (without deleting the original file) and so on

gzip -c a.txt > a.gz

gzip -c b.txt > b.gz

gzip -c c.txt > c.gz

echo $(stat -c "%n: %s " a.gz b.gz c.gz)

#5 Gzip a.txt, b.txt, c.txt into all_three.gz

gzip -c a.txt b.txt c.txt > all_three.gz

echo $(stat -c "%n: %s" all_three.gz)

#6 Gzip the all_three.tar we created in #3

gzip -c all_three.tar > all_three.tar.gz

echo $(stat -c "%n: %s" all_three.tar.gz)

# Check all files we created with ls command sorted by time in ascending order

ls -ltr a.txt b.txt c.txt all_three.tar a.gz b.gz c.gz all_three.gz all_three.tar.gz

You might be interested in
How do you know if you get a phone call that is a scam
Kamila [148]

It might have a really weird phone number, also if it sounds like its too good to be true it probably is. Good luck, and don't fall for scams!! XD

5 0
3 years ago
Read 2 more answers
Which risk management framework does the organization of standardization publish
olga2289 [7]

Answer:

ISO 31000:2009 publishes principles and generic guidelines on risk management.

Explanation:

ISO 31000:2009 can be applied to any public, private or community company, organization, society or individual. Hence, ISO 31000:2009 is not particular to either business or area.

ISO 31000:2009 can be implemented during the period of an industry and to a broad variety of actions, including policies and judgments, guidance, methods, functions, plans, goods, services, and assets.

ISO 31000:2009 can be implemented to any type of danger, whatever its kind, whether possessing positive or negative outgrowths.

3 0
3 years ago
9. Select the correct answer.
mihalych1998 [28]

Answer:

I believe the answer is exclusive but im not 100% sure

5 0
3 years ago
How does the speaker feel about traditional forms of poetry
Salsk061 [2.6K]
A speaker sometimes is not able to capture the intended details since it is affected by homophones.
7 0
3 years ago
Read 2 more answers
Is there a way I can put an already made sound that i created over an already made video
lys-0071 [83]
If you're using an apple product to do video editing, then iMovie is probably the best way to do that.

If you're on Windows and you're looking for a free video editing website, I'd suggest WeVideo. Although WeVideo does add watermarks to your videos, editing is pretty easy when using it.
6 0
3 years ago
Other questions:
  • A(n) ____ tag is used to let the compiler know that your intention is to override a method in a parent class
    10·1 answer
  • How must you rect to a flashing<br> Yellow traffic light?
    9·1 answer
  • Microprocessors can’t directly understand programming languages, so programs have to be converted into _____________ that corres
    15·1 answer
  • Which type of image uses lossy compression to reduce file size?
    14·1 answer
  • Match the item to the type.
    11·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • Which view in the View tab of the ribbon is the easiest place to add a header or a footer? Normal view Custom Views Page Layout
    5·2 answers
  • What is the first phone ever made?
    6·1 answer
  • What is the difference between the byte and short data types in Java?
    7·1 answer
  • What is the purpose of heading tags?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!