Question

In: Computer Science

Please create (if not already in your linux home directory) files of any type. Once these...

Please create (if not already in your linux home directory) files of any type. Once these files are created, archive them, compress the archive and move these files to the thrash directory. This could be a script to be run from the shell or the script to be run from an executable file.

Submit your code and clearly explain all steps of your script.

Solutions

Expert Solution

Shell script is:

$touch file1 file2 file3 #creates files with filename file1, file2, file3
$tar -czvf archive.tar.gz file1 file2 file3 #compresses
$gvfs-trash archive.tar.gz #moves into trash

Explanation:

touch command creates files with names file1 , file2, file3.

tar command is used to archive and compress the files. Syntax is

tar [arguments] [filename to be created] [files]

-c is used to archive the files, -z is used to compress the archive with gz , -v means verbose, -f allows you to create a name for your compressed file.

gvfs-trash command is used to move the file into trash.

Screenshots of command execution:

After executing above script see the trash folder. This command allows to view the contents of the trash.

$gvfs-ls trash://

file is moved into the trash.


Related Solutions

UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all its contents. Write a shell script to validate password strength. Here are a few assumptions for the password string.   Length – a minimum of 8 characters. • Contain alphabets , numbers , and @ # $ % & * symbols. • Include both the small and capital case letters. give a prompt of Y or N to try another password and displays an error...
Linux Use touch to create a file in your working directory called PutFileHere this is a...
Linux Use touch to create a file in your working directory called PutFileHere this is a linux question i acidentally put javascript when i first submitted it
using Linux please fill in the blanks : telnos files:
  using Linux please fill in the blanks : telnos files: telnos telnos2 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Holland Tod    A&S   744-8368 telnos3 telnos 4 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368...
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such...
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such that; Give the commands that would change the permissions. It will be a Linux system Only the owner Kitty can execute timer.exe. Kitty’s default group can write to the directory, but no one can delete or move any file except Kitty.
Step # 3 - Create the following structure in the home directory: Refer to previous Steps...
Step # 3 - Create the following structure in the home directory: Refer to previous Steps 1 + 2 for reference.   Do a tree to check your work as you go. No GUI, use command line only. Start by creating a directory within the home directory in which to experiment. Do a pwd and make sure you are in /home/pi Make a directory called YourInitials_fun Example: acf_fun In that directory, create a series of files and directories outlined below Make...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask the user for a line of text that the system should save to the file Add to the file the line of text entered by the user Ask the user for a second line of text that the system should save to the file Append at the end of the file the line of text entered by the user Create a copy of the...
Answer this fully please, type your answer, someone already answered it here but it was wrong,...
Answer this fully please, type your answer, someone already answered it here but it was wrong, only answer (((Quick ratio: ))))))and its not 1.2, 1.2 if you get any of these numbers dont reply to my question please PepsiCo, Inc. (PEP), the parent company of Frito-Lay snack foods and Pepsi beverages, had the following current assets and current liabilities at the end of two recent years: Current Year (in millions) Previous Year (in millions) Cash and cash equivalents $9,158 $9,096...
Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it;...
Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it; Provide command and screenshot. b) Create a hard link named “file2” linked to “file1”; c) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”. d) View information of the 4 files (what command should you use to produce output) – how do you verify which file is a hard link and which file is a...
Unix ramdom question. How do you display a list of files in your current directory, sorted...
Unix ramdom question. How do you display a list of files in your current directory, sorted by file size with the largest files at the top.
What are the permissions for your home directory set by your system administrator? What command did...
What are the permissions for your home directory set by your system administrator? What command did you use to answer the question? Show your session.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT