Previous Table of Contents Next

Module 102
pcat (SV)


The external pcat command displays the contents of a previously packed file. The pack command is used to create these files.

The pcat command will fail if any of the following conditions are encountered.

*  The file is not a packed file.
*  The filename has more than 14 characters when the .z is added.
*  The file cannot be opened.

If you want to create a copy of a packed file but leave the existing copy in place, you can use shell redirection in combination with the pcat command as follows:

     pcat file > newfile

This way you can create a new version of the unpacked file without losing the old version of the packed file.


Following is the general format of the pcat command.

     pcat file_list


The following describes the argument that may be passed to the pcat command.

file_list One or more packed files to be displayed on the standard output. You can specify the packed files with or without the .z extension. For example, to unpack passwd.z you could use either of the two command formats.
                  pcat passwd
                   pcat passwd.z


Refer to the pack and unpack commands described in Module 98.


The pcat command reads its input from packed file name.z and displays the text on the standard output.


The pcat command reads an exit status equal to the number of files it failed to display.


The pcat command is used to view previously packed files. It lets you view packed files without having to unpack the file, cat it out, and pack it again. You can also use the pcat command to obtain a copy of a packed file without removing the packed copy. If you use the unpack command, the packed version of the file is removed.


In this activity you use the pcat command to view your packed version of the passwd file. Begin at the shell prompt.

1.  Type pack passwd and press Return to pack your copy of the passwd file.
2.  Type pcat passwd.z and press Return. Notice the passwd file is displayed on your screen as it normally appears in a noncompressed state.
3.  Type unpack passwd and press Return to unpack the passwd file.
4.  Turn to Module 122 to continue the learning sequence.

Previous Table of Contents Next