| | |
Have I got this right? tar command.
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 22
Reputation:
Solved Threads: 0
hi. Does this command (tar cvf /usr/local/bin) create a tape achieve in /usr/local and then copies all the files and directories that are in the /bin directory into the tape archive that is stored in /usr/local?
If not then how does it work? I have looked around the internet and that's the answer that I came up with.
Cheers
If not then how does it work? I have looked around the internet and that's the answer that I came up with.
Cheers
•
•
Join Date: Aug 2007
Posts: 165
Reputation:
Solved Threads: 18
•
•
•
•
hi. Does this command (tar cvf /usr/local/bin) create a tape achieve in /usr/local and then copies all the files and directories that are in the /bin directory into the tape archive that is stored in /usr/local?
If not then how does it work? I have looked around the internet and that's the answer that I came up with.
Cheers
Assuming your tape device is /dev/nrst0, the following three lines commands are 'equivalent', though the final result is not necessarily the same:
Shell Scripting Syntax (Toggle Plain Text)
tar cvf /dev/nrst0 /usr/local/bin tar cvf - /usr/local/bin | dd of=/dev/nrst0 bs=1024k tar cvf /tmp/ulb.tar /usr/local/bin; dd if=/tmp/ulb.tar of=/dev/nrst0 bs=1024k
•
•
Join Date: Aug 2007
Posts: 165
Reputation:
Solved Threads: 18
OK. Tar is weirder than I thought. If GNU tar is called as 'tar cv /usr/local/bin', it will create a tar archive on STDOUT, seemingly in violation of the man page. Called as you indicated in your first post, it will respond with, "tar: Cowardly refusing to create an empty archive..." I don't know how other flavors and dialects of tar behave. In 20+ years of using tar, I've never encountered a version that works with what you provided.
•
•
Join Date: Jun 2009
Posts: 6
Reputation:
Solved Threads: 1
If you give such a cmd on HP-UX it will say :
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
and on AIX it will say:
tar: /usr/local/bin : Cannot write to a directory.
Fest3er has given good examples of using tar.
tar cvf <archive_name> <file_or_directory_to be archived> thats the syntax for tar
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
and on AIX it will say:
tar: /usr/local/bin : Cannot write to a directory.
Fest3er has given good examples of using tar.
tar cvf <archive_name> <file_or_directory_to be archived> thats the syntax for tar
![]() |
Similar Threads
- Pipe broken at 2GB when tarring to a samba mount (*nix Software)
- how to untar a tar.gz file in php script (PHP)
- how to implement tar command through php script (PHP)
- creating a backup file (Shell Scripting)
- Need help uncompressing tar.gz file (Shell Scripting)
- Live backup direct on CD/DVD (Legacy and Other Languages)
- Installing Software (*nix Software)
Other Threads in the Shell Scripting Forum
- Previous Thread: Using Multiple Arguments in Bash Script
- Next Thread: Automated ssh with top
| Thread Tools | Search this Thread |





