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
A network packet contains two kinds of information. What are they?
Salsk061 [2.6K]

Answer:

Connectionless and connection oriented information

Explanation:

There is wireless and wired information in a network so...

6 0
3 years ago
Read 2 more answers
Do u see abs??????????
vichka [17]

Answer

of course, y u askin tho, im pretty sure every person who doesnt have a sight disability can see her abs as well

Explanation:

4 0
2 years ago
You have an Active Directory forest of two trees and eight domains. You haven’t changed any of the operations master domain cont
Vikentia [17]

Answer:

Option C is the correct option.

Explanation:

The following option is correct because the user has two trees and also has eight domains of the Active Directory Forest and the user not done any alteration on the operations of the master domain controllers then, the schema master is on the 1st domain controller that is in forest root domain controller.

8 0
3 years ago
A computer is unable to successfully complete its boot sequence. The master book record is currently stored on the C drive.
k0ka [10]
The Master Boot Record (MBR for short) is the information in the first sector of the hard disk that shows how and where the operating system needs to be loaded.
3 0
3 years ago
A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields
Alex Ar [27]

Answer:

Written in Python:

dollars = int(input("Amount: "))

numFive = int(dollars/5)

numOnes = dollars%5

print(str(dollars)+" yields "+str(numFive)+" fives and "+str(numOnes)+" ones.")

Explanation:

This line prompts user for input

dollars = int(input("Amount: "))

This line calculates the number of 5 that can be gotten from the input. This is done using integer division

numFive = int(dollars/5)

This line gets the remaining ones. This is done by using the modulo sign to get the remainder when input is divided by 5

numOnes = dollars%5

This line prints the required output

print(str(dollars)+" yields "+str(numFive)+" fives and "+str(numOnes)+" ones.")

4 0
2 years ago
Other questions:
  • g Create a program that reads a list of states from an input file, puts them in order, and displays the sorted list to the user.
    15·1 answer
  • Please help me ! All you do is just put it it all in your own words ! Please this is for my reported card!i don't know how to pu
    15·1 answer
  • Write a brief one parapragh summary describing the financial reality of the American family.
    10·1 answer
  • Which of the following is the language used to create content that is shown on the World Wide Web?
    6·2 answers
  • Click to visit W3Schools.com
    14·2 answers
  • What are the pros and cons of using ICT
    5·1 answer
  • In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
    6·1 answer
  • Why is it important to use random assignment when determining which research participants will comprise the different treatment
    12·1 answer
  • Using hard disk to temporarily store data or instructions from ram is referred to as the
    12·1 answer
  • Someone say crackhead
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!