# User manual for GHex

GHex is a simple binary editor. It lets users view and edit a binary file in both hex and ascii with a multiple level undo/redo mechanism. Features include find and replace functions, conversion between binary, octal, decimal and hexadecimal values, and use of an alternative, user-configurable MDI concept that lets users edit multiple documents with multiple views of each.

2002
2003
2004
Sun Microsystems
1998-2000
Jaka Mocnik
GNOME Documentation Project
Sun
GNOME Documentation Team
Sun Microsystems

Jaka
Mocnik
GNOME Documentation Project

     jaka@gnu.org

GHex Manual V2.5
December 2005

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V2.4
April 2003

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V2.3
August 2002

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V2.2
August 2002

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V2.1
July 2002

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V2.0
March 2002

Sun GNOME Documentation Team

GNOME Documentation Project

GHex Manual V1.0
2000

Jaka Mocnik jaka@gnu.org

GNOME Documentation Project

This manual describes version 2.19 of GHex.

## Odziv

To report a bug or make a suggestion regarding the GHex application or this manual, follow the directions in the GNOME Feedback Page.

## Uvod

The GHex application enables you to perform the following actions:

- View a file in ASCII or hexadecimal format simultaneously.

- Edit a file in either ASCII or hexadecimal format.

## Getting Started

### To Start GHex

You can start GHex in the following ways:

Applications menu

  Choose Accessories Hex Editor.

Command line

  Execute the following command: `ghex`

### When You Start GHex

When you start GHex, the following window is displayed.

#### GHex Window Before You Open a File

Shows GHex main window before you open a file.

### To Open a File

To open a file, choose File Open. Select the file that you want to open, then click OK. You can open multiple files in GHex. GHex displays each file in a new window.

When you open a file in GHex, the application displays the file in the following window.

#### GHex Window with an Open File

Shows GHex main window with an open file

The GHex window contains the following elements:

Menubar

  The menus on the menubar contain all the commands that you need to work with files in GHex.

Cursor offsets column

  The cursor offset is the distance between the beginning of the file and the first byte in each line. By default, GHex displays the cursor offsets column to the left of the hexadecimal view.

Display pane on left side

  The display pane on the left side of the display area displays a hexadecimal view of the file.

Display pane on right side

  The display pane on the right side of the display area displays an ASCII view of the file.

Type conversion dialog

  The type conversion dialog below the display area displays the value of the selected character in several different numeric types.

## Usage

### To Edit a File

To edit a file, perform the following steps:

1. Click in the hexadecimal or ASCII view of the file. The view in which the cursor is active displays a full cursor. The view in which the cursor is not active displays an outline of the cursor.

2. Use any of the following methods to move the cursor around the file:

   - Use the scrollbar on the window or the arrow keys on the keyboard to scroll through the file.

   - Choose Edit Goto Byte, type the cursor offset as a decimal or hexadecimal value, then click OK. The format of the hexadecimal value must be 0x followed by the offset, for example 0x3.

3. Edit the ASCII format in the same way you edit a normal text file. To edit the hexadecimal format, use the values 0 to 9 and a to f.

To insert data and not overwrite existing data, choose Edit Insert Mode.

To cut, copy, and paste data, choose Edit Cut, Edit Copy, and Edit Paste.

To undo an edit, choose Edit Undo. To redo an edit, choose Edit Redo. The number of previous edits that you can undo is determined by the Maximum number of undo levels setting in the tabbed section of the Preferences dialog.

### To Save a File

You can save a file in the following ways:

- To save changes to the current file, choose File Save.

- To save the current file under a new filename, choose File Save As. Enter a name for the file in the Select a file to save buffer as dialog, then click OK.

### To Revert to the Last Saved Version of a File

To revert to the last version of the current file that you saved and undo all of the edits that you made to the file since you last saved the file, choose File Revert, then click Yes in the Question dialog.

### To Find Data in a File

To search a file for a hexadecimal or ASCII string, perform the following steps:

1. Choose Edit Find.

2. In the Find Data dialog, choose one of the following options:

   - Search for hex data

   - Search for ASCII data

3. Type the string that you want to find.

4. Click Find Next to find the next occurrence of the string.

5. Click Find Previous to find the previous occurrence of the string.

6. Click Cancel to close the Find Data dialog.

### To Perform an Advanced Find

To perform an advanced find, perform the following steps:

1. Choose Edit Advanced Find.

2. In the Find Data dialog, select the required search criteria. For information about how to add new search criteria, see .

3. Click Find Next to find the next occurrence of the string.

4. Click Find Previous to find the previous occurrence of the string.

5. Click Close to close the Find Data dialog.

### To Add Search Criteria

To add search criteria, perform the following steps:

1. Choose Edit Advanced Find.

2. In the Find Data dialog, click Add New.

3. In the Find Data: Add Search dialog, choose one of the following options:

   - Search for hex data

   - Search for ASCII data

4. Type the string that you want to find.

5. Use the color wheel or the spin boxes to select a color to highlight the search criteria.

6. Click Add.

7. Click Cancel to close the Find Data dialog.

### To Remove Search Criteria

To remove search criteria, perform the following steps:

1. Choose Edit Advanced Find.

2. In the Find Data dialog, select the search criteria that you want to remove.

3. Click Remove Selected.

4. Click Cancel to close the Find Data dialog.

### To Find and Replace Data in a File

To search a file for a hexadecimal or ASCII string and then replace the string, perform the following steps:

1. Choose Edit Replace.

2. In the Find & Replace Data dialog, choose one of the following options:

   - Replace hex data

   - Replace ASCII data

3. In the first text box, type the string that you want to find.

4. In the second text box, type the string that you want to use to replace the string that you find.

5. Click Find Next.

6. Click Replace to replace the current occurrence of the string or click Replace All to replace all occurrences of the string.

7. Click Cancel to close the Find & Replace Data dialog.

### To Add or Remove Additional Views of a File

To add another view of the current file to your GHex window, choose View Add View.

To remove a view of the current file, choose View Remove View. If you remove the last view that is open, the application exits.

### To Change the Data Group Type

To change how GHex displays the hexadecimal content of a file in the GHex window, choose View Group Data As, then select one of the following menu items:

- Bytes - single bytes

- Words - groups of two bytes

- Longwords - groups of four bytes

### To Export the GHex Display to HTML

To export the data contained in the GHex window to HTML, choose File Save As HTML. Choose a directory and specify a filename for the HTML file, then click OK. GHex implements the following actions:

- Creates a separate HTML file for each page of data that is displayed in the GHex window.

- Uses the HTML filename that you specify as the basis for the filename.

- Appends a page number to the filename to differentiate the files.

For example, if you specify the filename `log.html`, GHex creates a series of HTML files named `log00000000.html`, `log00000001.html`, `log00000002.html`, and so on.

### To View a Character Table

To view a table that contains the ASCII, hexadecimal, decimal, octal, and binary representations for the values 0 to 255, choose Windows Character Table.

### To View Data Conversions

To display the binary, decimal, hexadecimal, and ASCII conversions for up to four bytes of data, perform the following steps:

1. Choose Windows Base Converter.

2. Perform one of the following actions:

   - Type the data that you want to convert in one of the fields in the Base Converter dialog, then press Return.

   - To display the conversions for the data at the cursor position in the current file, click on the Get cursor value button.

   GHex updates the values of the other fields to display the data conversions.

3. Click Close to close the Base Converter dialog.

### To Show or Hide the Type Conversion Dialog

To show or hide the type conversion dialog, choose Windows Type Conversion Dialog.

The type conversion dialog displays the value of the selected character in the following representations:

- Signed 8 bit

- Unsigned 8 bit

- Signed 16 bit

- Unsigned 16 bit

- Signed 32 bit

- Unsigned 32 bit

- 32 bit float

- 64 bit float

- Hexadecimal

- Octal

- Binary

- Stream Length

The type conversion dialog also contains the following options:

Show little endian decoding

  Select this option to show little endian decoding.

Show unsigned and float as hexadecimal

  Select this option to show unsigned and float numbers as hexadecimal numbers.

### To Print a File

To print a file, choose File Print. Select the print options that you require in the Print dialog, then click OK.

To preview a printed copy of the file, choose File Print Preview.

## Preferences

To configure GHex, choose Edit Preferences. The Preferences dialog contains the following tabbed sections:

### Editing

Maximum number of undo levels

  Use this spin box to specify the maximum number of edits that you can undo.

Show cursor offset in statusbar as

  Use this drop-down list to select the format in which the cursor offset is displayed. The format can be decimal, hexadecimal, or a custom print style string that only contains the format specifiers x, o, and s.

Show offsets column

  Select this option to display the cursor offsets in a column to the left of the hexadecimal view of the GHex window.

### Display

Font

  Use the font selector list boxes to edit the existing font information or type new font information. Specify a font type, style, and size to display the contents of files in GHex.

Default Group Type

  Select one of the following options to specify how GHex displays the hexadecimal content of a file in the GHex window:

  - Bytes - single bytes

  - Words - groups of two bytes

  - Longwords - groups of four bytes

### Printing

Data font

  Click on the Data font button to specify the font type, style, and size to use to print the data contained in a file.

Header font

  Click on the Header font button to specify the font type, style, and size to use to print the header information that is contained in the file.

Print shaded box over

  Use this spin box to specify the number of lines that GHex alternately prints with a surrounding shaded box. If the value of the spin box is 10, GHex prints the first 10 lines of the file without a shaded box, the next 10 lines with a shaded box, and so on. If the value of the spin box is 0, GHex does not print any shaded box.