[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 2

ghost Command


Reconstructs previous versions of an INed structured file.


ghost OldName-d ] [ -p ] [ NewNameMonth/Day/Year Hour:Minute:Second ] ] ]


The ghost command reads a structured file and reconstructs a previous version of it in the output file. If you specify only the old file name using the OldName parameter, that will also be the name of the reconstructed version. The old file is backed up by appending a .bak file, making it the OldName.bak file.

Note: If your locale is not set to En_US, the date and time parameters may not be in the Month/Day/Year and Hour:Minute:Second format. The ghost command expects the date and time in the format specified by the current locale.

The Month/Day/Year parameter specifies a version date for the reconstruction. The Hour:Minute:Second parameter specifies the version time for the reconstruction. The default is the current date and time. If only the month and day are specified, the current year is assumed. If only the date is specified, the time is set to a value of 0 (midnight). If only the hour and minute are specified, the seconds are set to a value of 0. The hours are based on a 24-hour clock.

You can use the versions command to display the modification dates and times.


-d Deletes the .bak file after reconstructing the previous version.
-p Includes versions prior to, but not including, the date and time specified.


  1. To reconstruct the current version of the menu2 file as the newmenu file, enter:
    ghost menu2 newmenu
    This is useful if the menu2 file is damaged.
  2. To do the same thing as in example 1 but put the output in the menu2 file, enter:
    ghost menu2
    The old file is saved as the menu2.bak file.
  3. To reconstruct the July 15 version of the menu2 file as the newmenu file, enter:
    ghost menu2 newmenu 7/15
  4. To reconstruct the version of the menu2 file that existed on July 15, 1980 at 3:10 in the afternoon, enter:
    ghost menu2 newmenu 7/15/80 15:10
  5. To reconstruct the same version of the menu2 file down to the second, enter:
    ghost menu2 newmenu 7/15/80 15:10:45
    This is useful if several changes were made to a file in a very short time.

Related Information

The e command, history command, newfile command, readfile command, rmhist command, versions command.

INed Editor Overview in AIX Version 4.3 INed Editor User's Guide.

How to Access Previous Versions of a File with the INed Editor.

[ Previous | Next | Contents | Glossary | Home | Search ]