- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how can I chown, tar, gzip a directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 06:57 AM
02-06-2002 06:57 AM
I have a directory that I would like to chown. Then I would like to tar up the dir using relative path and then gzip the dir. Is there a single command that I can use to do all 3 of these please. Any help will be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:02 AM
02-06-2002 07:02 AM
SolutionYou could write a simple script like:
#!/usr/bin/sh
chown user dir_name
tar -cvf dir_name.tar ./dir_name
gzip dir_name.tar
Be sure to save the script, do a chmod on it to make it executable and then execute it from the command line.
# chmod u+x script_name
# ./script_name
Once it is done:
# ll dir_name.tar.gz
Should show you your gzip'ed tar file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:04 AM
02-06-2002 07:04 AM
Re: how can I chown, tar, gzip a directory
chown user:group /dir/path
to chown every file in the directory do:
chown user:group /dir/path/*
to chown every fine in the directory, and every sub-directory and every file in every sub-directory do:
chown -R user:group /dir/path/*
to tar do:
tar /dirpath/targetfile /dirpathsource/*
then to gzip the file you just created with tar:
gzip /dirpath/targetfilefromabove >newfile.gz
obviously, you have to rename all the directory and file references to what's on your system. And while not required, using the .gz extention on the gzip file is recommended.
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:07 AM
02-06-2002 07:07 AM
Re: how can I chown, tar, gzip a directory
# chown root:sys ov; tar cvf ov.tar ov; gzip ov.tar
Not actually a single command but all commands are in one line. Not sure if this is what you're asking about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:07 AM
02-06-2002 07:07 AM
Re: how can I chown, tar, gzip a directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 08:06 AM
02-06-2002 08:06 AM
Re: how can I chown, tar, gzip a directory
In keeping with the one line command and to save disk space, use this:
tar cvf - ./relpath_dir | gzip >output_tarfile.gz
The "intermediate" tarfile is not stored on disk, only the gzipped one. Also, when gzipping a file, the input file is left on disk until the gzip is finished. Thus even more space is used.
The reverse process is:
gzip -dc output_tarfile.gz | tar xf -
Darrell