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
MmfbfMMMMMMMMMMMMMMMMMmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Mumz [18]

Explanation:

bdhabsusvsjsvdhewjsbdueyssbwksv

6 0
3 years ago
You’ve been given a new cell phone with a 2 gigabyte data plan. You plan to use your phone for text messages, images, video, and
Katarina [22]

Answer:

IUYTR

Explanation:

5 0
3 years ago
The physical parts or components of a computer system is called
liq [111]
The ConputergefvkdevkdegkedgkgxkgwxkzgkfzsjsfzjzsdjszfjwzfhwfwHkdKGWsqkgddaqhkdqakgQdgkQGgqzdgzkqdhqkfzqkhqczljaxhlcwzhlzchaxlhwxgkwdgkwdwkzgzmgzgkwdgmwzdgzwkdamxadmhfzahm
8 0
3 years ago
Read 2 more answers
Which open-sourced packet capture tool uses linux and mac os x operating systems?
Leto [7]

Tcpdump is an open-sourced packet capture tool which uses Linux and Mac OS X operating systems.

<h3>What is tcpdump?</h3>

Tcpdump can be defined as an open-sourced packet capture tool that is typically used to monitor and record TCP/IP traffic that are passing through a network and most Unix-like operating systems such as Linux.

This ultimately implies that, tcpdump is an open-sourced packet capture tool which makes use of Linux and Mac OS X operating systems.

Read more on tcpdump here: brainly.com/question/14485515

#SPJ12

5 0
2 years ago
What kind of waste does a computer generate?<br><br> Will give brainly :3
Lena [83]

Answer:

waste???? a computer??

7 0
3 years ago
Other questions:
  • Most panoramic photography focuses on what subject?
    9·2 answers
  • _ are typically comprised of a mix of _ and _
    11·2 answers
  • Digital information is stored using a series of ones and zeros. Computers are digital machines because they can only read inform
    15·1 answer
  • What are personal skills? A manner of individual style How a person manages and expresses oneself One's ability to excel at spor
    13·2 answers
  • Refer to the exhibit. All workstations are configured correctly in VLAN 20. Workstations that are connected to switch SW1 are no
    14·1 answer
  • Hey anyone wanna zoom.
    7·2 answers
  • To print factorial of any<br>input number <br>QBASIC​
    6·1 answer
  • How do you give brainlest things out?
    14·2 answers
  • Select the data type for each example below. <br> Possible answers<br> -Int<br> -float <br> -string
    11·1 answer
  • Which of the following Office Online apps is most effective for creating multi-media presentations?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!