Solved

Explanation for bash code using tar

Posted on 2014-03-11
4
345 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now