Solved

Explanation for bash code using tar

Posted on 2014-03-11
4
354 Views
Last Modified: 2014-03-11
Question:

Using the tar utitlity, give the specific command(s) you would use to move files a, b, and c from directory
/users/student/rios to /etc/tmp
 

Answer:
( cd /users/student/rios && tar cf - a b c) | (cd /etc/tmp && tar xvpf - )

Open in new window


can someone tell me what tar cf does and why we need the &&. also does the  | mean we are moving the items to the left? why the xvpf - ?

thanks
0
Comment
Question by:Mark_Co
  • 3
4 Comments
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 500 total points
ID: 39921374
&& will do the second action only if the first action returns 0 - which means the action was successful

tar x wil e(x)tract the files. v is usually from verbose.

| will pipe the output of the left command to the command on the right

HTH,
Dan
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 500 total points
ID: 39921389
Look at the man page for tar here: http://unixhelp.ed.ac.uk/CGI/man-cgi?tar

c - create
x - extract
v - verbose
p - preserve permissions
f - file
0
 

Author Closing Comment

by:Mark_Co
ID: 39921606
Much obliged
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39921610
Glad I could help!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
help with PowerShell script for registry permissions 8 82
Choosing CentOS 16 79
change the windows script file to BAT 10 40
LINUX backups with VEEAM 8 80
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question