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
the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
marta [7]
A. the modem provides the wifi or internet to the computer
6 0
3 years ago
Read 2 more answers
Why might a variable used for output have to be of a different type then a variable used for input?​
telo118 [61]

Answer:

You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.

Explanation:

Your input may have to be different then output varying on what data you are processing.

For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.

Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.

Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.

Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:

<u>Code (Python)</u>

def IsSmart(gpa):

  if (gpa >= 4):

       return True

  else

       return False

As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.

7 0
3 years ago
Which devices are managed through device management?
mr_godi [17]
Android<span>, </span>iOS<span>, Windows and </span>Blackberry<span> devices.</span>
3 0
3 years ago
Suppose we are sorting an array of nine integers using heapsort, and we have just finished one of the reheapifications downward.
Ilia_Sergeevich [38]

Answer:

3

Explanation:

Heap sort pick an item from the first or last position in an array and compares it with other items in other positions in the array, swapping position if they meet the condition.

The array above has three maximum items arranged sequentially in the array, this is prove that there have been 3 reheapifications in the array.

7 0
3 years ago
Anyone willing to help with Excel?!!
anastassius [24]

Hi!

I have a slight understanding of excel, it depends on what you need.

8 0
3 years ago
Other questions:
  • The eastern front was longer than other fronts of the war true or false
    7·2 answers
  • How would I view the ruler on my document if it was not visible
    9·1 answer
  • What would happen to a eukaryotic cell if all its mitochondriawere destroyed
    7·1 answer
  • Why might your digital footprint be important when you are applying for collage
    13·1 answer
  • What processes are needed to transform a c++ program to a machine language program that is ready for execution?
    14·1 answer
  • According to Fourman, Informatics is _______________ with a very _____________ scope.
    5·2 answers
  • What is an internal node?
    11·1 answer
  • Propose a data structure that supports the stack push and pop operations and a third operation findMin, which returns the smalle
    12·1 answer
  • Have fire have ....<br><br>babi​ from babi098
    7·1 answer
  • ________(fill in the blank)in online education is intrinsically related to equity.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!