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
Why might your coworker suggest encrypting an archive file before e-mailing it??
Genrish500 [490]
Because to prevent MITD (Man in the middle is a man that in the middle of the network. For example: You are sending a text, the man in the middle or in the modem will receive the text and can edit it and send it to the receiver, or the man will put the virus in...) and to prevent server snooping
8 0
3 years ago
Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
svlad2 [7]

Answer:

The program in Python is as follows:

currentPrice = int(input("Current: "))

lastMonth = int(input("Last Month: "))

print("The house is $",currentPrice)

print("The change is $",(currentPrice-lastMonth),"since last month")

print("The estimated monthly mortgage is $",(currentPrice * 0.051) / 12)

Explanation:

Get input for current price

currentPrice = int(input("Current: "))

Get input for last month price

lastMonth = int(input("Last Month: "))

Print current price

print("The house is $",currentPrice)

Print change since last month

print("The change is $",(currentPrice-lastMonth),"since last month")

Print mortgage

print("The estimated monthly mortgage is $",(currentPrice * 0.051) / 12)

6 0
3 years ago
Two or more computers connected together is referred to as a(n)
oksian1 [2.3K]
That would be a network my friend. When two or more computers are connected to one another, you have a network.
8 0
3 years ago
How do you play game on phone<br>​
ser-zykov [4K]
You download a game from the App Store
5 0
3 years ago
Read 2 more answers
Companies use various output ____ methods to maintain output integrity and security.
Len [333]
<span>Companies use various output control methods to maintain output integrity and security.</span>
8 0
3 years ago
Other questions:
  • Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids.Sample output for the g
    11·1 answer
  • Application programmers specialize in developing system software such as operating systems, device drivers, security modules, an
    10·1 answer
  • What does SMTP stand for?
    6·2 answers
  • PowerPoint’s _____ feature can assist you in finding answers to questions such as “How can I specify which slides to print?” a.
    6·1 answer
  • "The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "
    15·1 answer
  • What do character formats do for your document's message? A. Set how text aligns within a document B. Provide organization C. Pr
    6·2 answers
  • Which of the following is a step in paraphrasing?
    14·2 answers
  • What is the film format that many filmmakers feel is superior to any other format?
    13·1 answer
  • What will be the output of the following code snippet? token = False while token : print("Hello")
    11·1 answer
  • Create an application (that uses the SortedABList) that allows a user to enter a list of countries that he or she has visited an
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!