Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Explanation for bash code using tar

Posted on 2014-03-11
4
Medium Priority
?
384 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 35

Accepted Solution

by:
Dan Craciun earned 2000 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 35

Assisted Solution

by:Dan Craciun
Dan Craciun earned 2000 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 35

Expert Comment

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

971 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