Editing
Solaris 10 Associate
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Archiving files == tar or jar commands are two commonly used archiving commands * use tar command to create & extract files from a file archive * tar command archives files to & extracts files from a single file called a tar file * default device for tar file is magnetic tap device * Syntax: <code>tar functions archivefilename filenames</code> Functions for tar command: <table style="text-align: left; width: 50%;" border="1" cellpadding="2" cellspacing="0"> <tr> <td>function</td> <td>definition</td> </tr> <tr> <td>c</td> <td>creates a new tar file</td> </tr> <tr> <td>t</td> <td>lists the table of contents of the tar file</td> </tr> <tr> <td>x</td> <td>extract files from the tar file</td> </tr> <tr> <td>v</td> <td>executes in verbose mode, writes to the standard output</td> </tr> <tr> <td>f</td> <td> * specifies archive file or tape device * default tape device is /dev/rmt/0 * if name of archive file is "-" the tar command reads from standard input when reading from a tar archive or writes to standard output if create tar archive </td> </tr> <tr> <td>h</td> <td>follows symbolic links as standard files or directories</td> </tr> </table> Example of list contents in tar: <code>tar -tf /stage/installdir.tar</code> === archive on USB drive === Volume Management daemon, vold, provides automatic detection of removable media <add info volcheck command> if not detected but not mounted run <code>$ volrmmount -i rmdisk0</code> perform volrmmount command to create the /rmdisk directory and its contents when a flash drive is present access files of flash drive by changing to /rmdisk/rmdisk0 directory eject flash drive by using <code>eject</code> command example syntax: <code>eject rmdisk0</code> cannot be in working directory of the removable media while attempting to eject === using <code>jar</code> command === * use <code>jar</code> command to compress & combine multiple files into a single archive * Syntax: <code>jar options destination filenames</code> Options for tar command: <table style="text-align: left; width: 50%;" border="1" cellpadding="2" cellspacing="0"> <tr> <td>function</td> <td>definition</td> </tr> <tr> <td>c</td> <td>creates a new <code>jar</code> file</td> </tr> <tr> <td>t</td> <td>lists the table of contents of the <code>jar</code> file</td> </tr> <tr> <td>x</td> <td>extract files from the <code>jar</code> file</td> </tr> <tr> <td>f</td> <td>specifies <code>jar</code> file to process, the <code>jar</code> command sends data to screen if <code>f</code> option is not used </td> </tr> <tr> <td>v</td> <td>executes in verbose mode</td> </tr> </table> <insert examples using <code>jar</code> command> === compressing files === ==== using <code>compress</code> command ==== Syntax: <code>compress [ -v ] filename</code> compress command replaces the original file with a new file that has a <code>.Z extension</code> <insert examples using <code>compress</code> command> <code>$ compress -v file1.tar</code> ==== using <code>7za</code> command ==== Syntax: <code>7za command archivefile filenames</code> or <code>7za command archivefile directory</code> Add file to archive <code>7za a file.7z fileToArchive<code> Extract file from archive <code>7za e file.7z</code> Add directory to archive <code>7za a file.7z directoryToArchive</code> Extract directory from archive <code>7za e file.7z</code> ==== <code>zcat</code> command ==== use <code>zcat</code> command to view files that were compressed by the <code>compress</code> command <code>zcat</code> command allows user to view contents of file & doesn't modify contents of a compressed file Syntax: <code>zcat filename</code> <insert examples of <code>zcat</code> command> Extract contents of compressed tar without uncompressing the tar file first: <code>$ zcat files.tar.Z | tar xvf -</code> === uncompressing files === use <code>uncompress</code> command to uncompress Syntax: <code>uncompress options filename</code> <insert examples of uncompress command> === <code>gzip</code> command === use <code>gzip</code> to compress files Syntax: <code>$ gzip [ -v ] filenames</code> use <code>gzip</code> to uncompress files that have been compressed with gzip Syntax: <code>gzip -d filename</code> Example: <code>gzip -d game_installation.tar.gz</code> use <code>gzip -l filename.gz</code> to list contents of gzip file Example: <pre>bash-3.2# gzip -l installdir.tar.gz compressed uncompressed ratio uncompressed_name 262314451 798312448 67.1% installdir.tar</pre> === use <code>gzcat</code> command === use <code>gzcat filename</code> command to !!view!! files that were compressed with <code>compress</code> or <code>gzip</code> commands original file is unchanged Syntax: <code>gzcat filename</code> <insert examples of using <code>gzcat</code> command> === use <code>zip & unzip</code> command === * use <code>zip</code> command to compress multiple files into a single archive file * syntax: <code>zip target_filename source_filenames</code> * by default zip will add .zip extension * use <code>zip</code> command to uncompress a zipped file * syntax: <code>zip filename</code> * use <code>unzip</code> command with <code>-l</code> option to list the files in a zip archive * syntax: <code>unzip -l filename</code> <insert examples of using zip and unzip commands>
Summary:
Please note that all contributions to GotOpinion may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
GotOpinion:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information