In: Computer Science
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.
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.