[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 110: Undefined array key "cached"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 111: Undefined array key "normal"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 112: Undefined array key "total"
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3391: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3395: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
Cabrillo College Linux Classes • View topic - Trying to understand tar

Trying to understand tar

UNIX/Linux System Administration

Trying to understand tar

Postby denise gant on Tue Dec 02, 2008 12:20 pm

Below, I listed the resulted of the two different ways we tar'd a file. I can see the difference; but what I'd like to do is understand the difference. Hopin you can help with that?

1=tar cvf /root/logfiles.tar .
2=tar cvf logfile2.tar /var/log


[root@cis191 ~]# ls
anaconda-ks.cfg install.log lab07 ownerinfo
Desktop install.log.syslog logfiles.tar


[root@cis191 log]# ls
acpid conman.old logfile2.tar ppp secure.3
anaconda.log cron mail prelink spooler
anaconda.syslog cron.1 maillog rpmpkgs spooler.1
anaconda.xlog cron.2 maillog.1 rpmpkgs.1 spooler.2
audit cron.3 maillog.2 rpmpkgs.2 spooler.3
boot.log cups maillog.3 rpmpkgs.3 tallylog
boot.log.1 dmesg messages samba vbox
boot.log.2 faillog messages.1 scrollkeeper.log wtmp
boot.log.3 gdm messages.2 secure Xorg.0.log
btmp httpd messages.3 secure.1 Xorg.0.log.old
conman lastlog pm secure.2 yum.log
[color=#8000BF][b]Think like you have no brain[/b][/color]
User avatar
denise gant
 
Posts: 67
Joined: Tue Sep 02, 2008 7:13 pm

Re: Trying to understand tar

Postby John LeMieux on Tue Dec 02, 2008 5:30 pm

tar uses a relative path to let it know where to extract the files to. The first example, "tar cvf /root/logfiles.tar ." tells tar to make an archive file in the /root directory and to put every file in the current directory into it. The files in the tarball would have a path relative to the current directory. The second example, "tar cvf logfile2.tar /var/log" tells tar to make an archive file in the current directory and put every file in the /var/log directory into it. The files in the tarball all have a path starting with var/log.
User avatar
John LeMieux
 
Posts: 22
Joined: Tue Sep 02, 2008 7:12 pm


Return to CIS 191B - Fall 2008

Who is online

Users browsing this forum: No registered users and 0 guests

cron