Question

In: Computer Science

unix/Linux Create a tar command using the man command and the link referred to in To...

unix/Linux

Create a tar command using the man command and the link referred to in To Practice and Explore: Text File Utilities #9.

Preliminaries

  1. Use the man pages to learn more about tar
  2. Review the links referred to in To Practice and Explore: Text File Utilities #9 to see examples of using tar command

Perform

Use tar "to stuff" three files and then "unstuff" them into a new directory. Include the -v option.

Task

  1. ll to show the original 3 files
  2. run the tar command to stuff three files
  3. ll to show the 'tar archive'
  4. run mkdir newdir to create a new directory to unstuff the 'tar archive'
  5. mv the 'tar archive' to the new directory newdir
  6. from newdir run the tar command to unstuff the three files into the newdir directory
  7. ll the new directory newdir to show the extracted files

Solutions

Expert Solution

he Linux 'tar' stands for tape archive, is used to create Archive and extract the Archive files. tar command in Linux is one of the important command which provides archiving functionality in Linux. We can use Linux tar command to create compressed or uncompressed Archive files and also maintain and modify them..................

Syntax:

tar [options] [archive-file] [file or directory to be archived]

Options:
-c : Creates Archive
-x : Extract the archive
-f : creates archive with given filename
-t : displays or lists files in archived file
-u : archives and adds to an existing archive file
-v : Displays Verbose Information
-A : Concatenates the archive files
-z : zip, tells tar command that create tar file using gzip
-j : filter archive tar file using tbzip
-W : Verify a archive file
-r : update or add file or directory in already existed .tar file...............

Examples:
1. Creating an uncompressed tar Archive using option -cvf : This command creates a tar file called file.tar which is the Archive of all .c files in current directory.........................

$ tar cvf file.tar *.c

Output :

os2.c
os3.c
os4.c

2. Extracting files from Archive using option -xvf : This command extracts files from Archives.

$ tar xvf file.tar

Output :

os2.c
os3.c
os4.c
NAME
       tar - an archiving utility

SYNOPSIS
   Traditional usage
       tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...]

   UNIX-style usage
       tar -A [OPTIONS] ARCHIVE ARCHIVE

       tar -c [-f ARCHIVE] [OPTIONS] [FILE...]

       tar -d [-f ARCHIVE] [OPTIONS] [FILE...]

       tar -t [-f ARCHIVE] [OPTIONS] [MEMBER...]

       tar -r [-f ARCHIVE] [OPTIONS] [FILE...]

       tar -u [-f ARCHIVE] [OPTIONS] [FILE...]

       tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]

   GNU-style usage
       tar {--catenate|--concatenate} [OPTIONS] ARCHIVE ARCHIVE

       tar --create [--file ARCHIVE] [OPTIONS] [FILE...]

       tar {--diff|--compare} [--file ARCHIVE] [OPTIONS] [FILE...]

       tar --delete [--file ARCHIVE] [OPTIONS] [MEMBER...]

       tar --append [-f ARCHIVE] [OPTIONS] [FILE...]

       tar --list [-f ARCHIVE] [OPTIONS] [MEMBER...]

       tar --test-label [--file ARCHIVE] [OPTIONS] [LABEL...]

       tar --update [--file ARCHIVE] [OPTIONS] [FILE...]

       tar --update [-f ARCHIVE] [OPTIONS] [FILE...]

       tar {--extract|--get} [-f ARCHIVE] [OPTIONS] [MEMBER...]
NOTE
       This  manpage  is  a short description of GNU tar.  For a detailed
       discussion, including examples and usage recommendations, refer to
       the  GNU  Tar  Manual  available  in  texinfo format.  If the info
       reader and the tar documentation are properly  installed  on  your
       system, the command

           info tar

       should give you access to the complete manual.

       You  can  also view the manual using the info mode in emacs(1), or
       find it in various formats online at

           

       If any discrepancies occur between this manpage and  the  GNU  Tar
       Manual, the later shall be considered the authoritative source.

Related Solutions

Linux What is the tar command? a. Can you compress files using tar? Please explain how...
Linux What is the tar command? a. Can you compress files using tar? Please explain how and provide a brief example. b. How do you create a tar file? Please provide an example. c. How do you extract files in a tar format? Please provide an example.
Using sed unix / linux command how would I execute this: Move the first 2 characters...
Using sed unix / linux command how would I execute this: Move the first 2 characters on each line to the end of the line
please use linux or unix to complete Diff command The diff command displays differences between two...
please use linux or unix to complete Diff command The diff command displays differences between two files on a line-by-line basis. It displays the differences as instructions that you can use to edit one of the files ( using the vi editor) to make it the same as the other. When you use diff, it produces a series of lines containing Append (a), Delete (d), and Change (c) instructions. Each of these lines is followed by the lines from the...
Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed...
Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed description indicating all the Input/Output (I/O) connections. Every stdin, stdout, and stderr for each command will need to connect to something. grep a < words | wc -l > a_count.txt 22. Explain what is wrong (if anything) with the following command pipeline. cd | ls 23. Stream Editor: Write a sed command to delete digits, but only on lines that end with a period....
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would type to... Quit the vi editor and save any changes? 7. C language source files, by convention, have the suffix ".c". The associated "header" files have the suffix ".h". What is the command to perform the following task: List all the C source and C header files in the current directory. [Hidden files may remain hidden.] 8. C language source files, by convention, have...
Systems Programming - File Operations Create your version of the tail command in Linux using C...
Systems Programming - File Operations Create your version of the tail command in Linux using C The lseek system call allows you to move the current position anywhere in a file. The call lseek(fd, 0, SEEK_END) moves the current position to the end of the file. The tail command displays the last ten liens of a file. Try it. tail has to move, not to the end of the file, but to a spot ten lines before the end of...
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...
Unix Create a script that will declare an array and assign four values from the command...
Unix Create a script that will declare an array and assign four values from the command line. 1. Use these four values - Paul, Ringo, George, John, - in that order 2. Display the content of the array, displaying the values in this format and this order The first array value is "John" The second array value is "Paul" The third array value is "George" The fourth array value is "Ringo"
What are control structures in Linux/Unix?
What are control structures in Linux/Unix?
Doing the work on Linux in Putty: You are to create a hard link to one...
Doing the work on Linux in Putty: You are to create a hard link to one of your existing files on someone else's directory (or vice versa). In other words, you know that you can link a file within your own directories, but you can also have a link to one of your files on other areas of the unix system as long as you have permissions to write to that directory (in this case, your partner). Create a subdirectory...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT