Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Using cpio

Expert Oracle Database Tips by Donald BurlesonMarch 22, 2015

Using cpio

While I do not recommend cpio for creating backups or moving files between systems, it may be found that software that has been downloaded is delivered in .cpio files.  For quite some time Oracle delivered their software in this format, so it is important to be able to extract these files.

Unlike many other utilities, cpio reads data from standard input.  To extract data from a .cpio file, redirect the file contents into the cpio command using the < character.  The flags idmv tell cpio to extract data, create directories if they do not exist, preserve file and directory modification times, and print verbose output.

$ cpio -idmv < disk1.cpio

Using zip and unzip to Compress and Uncompress Files

Software is frequently delivered in zip filessince extraction utilities are available on just about every modern operating system.  Zip files can be easily extracted using the unzip command, providing only a file name as an argument.

$ unzip

   creating: database/
   creating: database/doc/
   creating: database/doc/dcommon/
   creating: database/doc/dcommon/css/
  inflating: database/doc/dcommon/css/blafdoc.css 
  inflating: database/doc/dcommon/css/darbbook.css 
  inflating: database/doc/dcommon/css/darbbook.css~ 
  inflating: database/doc/dcommon/css/doccd.css 
   creating: database/doc/dcommon/gifs/
  inflating: database/doc/dcommon/gifs/bookbig.gif 
  inflating: database/doc/dcommon/gifs/bookicon.gif 

The unzip commandprints a list of directories created and files extracted from the source file.

Creating a zip file is similar to creating a tar file,but no options are needed.  A destination file name is given as the first argument, then the files to be added to the zip file can be given in one or more additional arguments.

$ zip oracle_profile
adding: oracle_profile (deflated 15%)
$ ls

devl  emrep  oracle_profile  orcl  TEST

Note that unlike on Windows, the original file is not deleted when a zip file is created.  If space needs to be saved, go back and delete the original.

To create a zip file with the contents of a directory, use the -r (recursive) option.

$ zip -r devl
    adding: devl/ (stored 0%)
  adding: devl/dpdump/ (stored 0%)
  adding: devl/dpdump/dp.log (deflated 16%)
  adding: devl/pfile/ (stored 0%)
  adding: devl/pfile/init.ora.22201013228 (deflated 71%)
  adding: devl/adump/ (stored 0%)

When this zip file is extracted, the directory structure and files are recreated.

Using gzip and gunzip to Compress and Uncompress Files

The gzipcompression format has become one of the most broadly accepted formats thanks to its very good compression algorithm and fast performance.  To compress a file, use gzip with the file name as an argument.

$ gzip notes_chapter1.txt
$ ls -l

total 48
drwxr-xr-x 2 jemmons jemmons 4096 Sep 16 13:19 Desktop
drwxrwxr-x 2 jemmons jemmons 4096 Jan 17 13:17 notes
-rw-rw-rw- 1 jemmons jemmons  589 Jan 17 07:46
-rw-rw-r-- 1 jemmons jemmons 1525 Jan 17 13:07 notes.tar.gz
drwxrwxr-x 2 jemmons jemmons 4096 Jan 17 11:18 old_notes
drwxr-xr-x 2 jemmons jemmons 4096 Nov  8 08:37 scripts

Unlike tar, gzip removes the original file after creating the compressed version.  The .gz file name extension is also automatically added to the file name.  To uncompress a gzip file, the gunzip commandis used with the file name as an argument.

$ gunzip notes_chapter1.txt.gz
$ ls -l

total 48
drwxr-xr-x 2 jemmons jemmons 4096 Sep 16 13:19 Desktop
drwxrwxr-x 2 jemmons jemmons 4096 Jan 17 13:17 notes
-rw-rw-rw- 1 jemmons jemmons 1027 Jan 17 07:46 notes_chapter1.txt
-rw-rw-r-- 1 jemmons jemmons 1525 Jan 17 13:07 notes.tar.gz
drwxrwxr-x 2 jemmons jemmons 4096 Jan 17 11:18 old_notes
drwxr-xr-x 2 jemmons jemmons 4096 Nov  8 08:37 scripts

Again, the compressed version of the file is removed after it is uncompressed.

Getting Rid of the Wrong New Line Characters

If you have worked with other UNIX platforms or older versions of Linux, you have probably seen files where each new line was accompanied by the characters ^M.  These come from the file being created or transferred to a Windows or older Macintosh system where the new line characters are represented differently.  RHEL5 and some of its UNIX contemporaries now display or at least hide these characters properly, but they are still there and may occasionally give some trouble with applications that are not prepared to handle them.

For that reason, there is a utility to convert files from the Windows format to what UNIX expects.  Since RHEL5 displays files correctly regardless of the file format, use the file command to identify the Windows formatted files.  If the file command returns a format 'with CRLF line terminators', there are Windows-style new lines.  In that case, use the dos2unix command to convert them.

$ file hosts.txt

hosts.txt: ASCII English text, with CRLF line terminators

$ dos2unix hosts.txt

dos2unix: converting file hosts.txt to UNIX format ...

$ file hosts.txt

hosts.txt: ASCII English text

Similarly, when copying files from a Linux system to a Windows system, it may be found that everything displays on a single line in some editors, especially Notepad.  To avoid this, use a similar utility called unix2dos.  This accomplishes the opposite result, adding the new line characters Windows will expect.



Get the Complete Details on
Linux System Management for Oracle DBAs  

The landmark book "Linux for the Oracle DBA: The Definitive Reference" provides comprehensive yet specific knowledge on administering Oracle on Linux.   A must-have reference for every DBA running or planning to run Oracle on a Linux platform.

Buy it for 30% off directly from the publisher.



Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster