# 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.

## 回饋

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

## 介紹

您可以使用 GHex 應用程式，執行下列動作：

- 同時以 ASCII 或十六進制格式檢視檔案。

- 以 ASCII 或十六進制格式編輯檔案。

## 入門

### 啟動GHex

您可以使用下列方式啟動 GHex：

應用程式功能表

  請選擇周邊裝置十六進位編輯器。

指令行

  Execute the following command: `ghex`

### 開啟檔案

如果要開啟檔案，請選擇檔案開啟。請選取要開啟的檔案，然後按一下確定。您可以在 GHex 中開啟多個檔案。 GHex 會將每個檔案分別顯示在新視窗中。

在 GHex 中開啟檔案時，本應用程式會在下面的視窗中顯示檔案。

#### 含有開啟檔案的 GHex 視窗

Shows GHex main window with an open file

GHex 視窗中包含下列元素：

功能表列

  功能表列上的功能表，有在 GHex 中使用檔案時，所需要的所有指令。

游標偏移欄位

  游標偏移量是指檔案開頭與各行第一個位元組之間的距離。 依預設值，GHex 會在十六進制檢視的左邊，顯示游標偏移量欄位。

左邊的顯示窗格

  顯示區域左邊的顯示窗格，會以十六進制顯示檔案。

右邊的顯示窗格

  顯示區域右邊的顯示窗格，會以 ASCII 制顯示檔案。

Type conversion dialog

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

## 使用

### 編輯檔案

如果要編輯檔案，請執行下列步驟：

1. 請按一下檔案的十六進位或 ASCII 檢視。 檢視若為作用中，則會顯示完整的游標。 檢視若為非作用中，則只會顯示游標的外框。

2. 請使用下列任一種方法，在檔案中移動游標：

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

   - 請選擇編輯到位元，以十進制或十六進制鍵入游標偏移量，然後按一下確定。十六進制數值的格式，必須為 0x 加上偏移量，例如 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 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.

### 在檔案中尋找資料

如果要在檔案中搜尋十六進制或 ASCII 字串，請執行下列步驟：

1. 請選擇 編輯尋找。

2. 在尋找資料對話方塊中，選擇下列任一項選項：

   - Search for hex data

   - Search for ASCII data

3. 請輸入您想要尋找的字串。

4. 按一下尋找下一個，尋找下一個符合的字串。

5. 按一下尋找上一個，尋找上一個符合的字串。

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. 按一下尋找下一個，尋找下一個符合的字串。

4. 按一下尋找上一個，尋找上一個符合的字串。

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. 請輸入您想要尋找的字串。

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.

### 在檔案中尋找並取代資料

如果要先在檔案中搜尋十六進制或 ASCII 字串，然後取代該字串，請執行下列步驟：

1. 請選擇編輯取代。

2. 在尋找 & 取代資料對話方塊中，選擇下列任一項選項：

   - Replace hex data

   - Replace ASCII data

3. 請在第一個文字方塊中，輸入您想要尋找的字串。

4. 請在第二個文字方塊中，輸入您想要取代所尋找字串的字串。

5. 請按一下尋找下一個。

6. 請按一下取代，取代目前所在位置的字串；或是按一下全部取代，取代所有該字串。

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

### 新增或移除檔案的其他檢視

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

如果要移除目前檔案的檢視，請選擇檢視移除檢視。如果您移除的是最後一個開啟的檔案，本應用程式便會結束。

### 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

### 匯出 GHex 檢視至 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.

### 檢視字元表

如果要檢視以 ASCII、十六進位、十進位、八進位及二進位表示法表示 0 到 255 數值的表格，請選擇視窗字元表。

### 檢視資料轉換

如果要顯示最多四個位元組資料的二進制、十進制、十六進制以及 ASCII 轉換，請執行下列步驟：

1. 請選擇視窗基數轉換程式。

2. 執行下列任一項動作：

   - 請在基數轉換程式對話方塊的其中一個欄位，鍵入要轉換的資料，然後按一下 Return。

   - 如果要在目前檔案的游標位置顯示資料轉換，請按一下取得游標值按鈕。

   GHex 會更新其他欄位的數值，顯示資料轉換。

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.

### 列印檔案

如果要列印檔案，請選擇檔案列印。請在列印對話方塊中，選取所需的列印選項，然後按一下確定。

如果要預覽列印檔案的副本，請選擇檔案列印預視。

## 個人喜好

如果要配置 GHex，請選擇編輯個人喜好。在個人喜好對話方塊中，含有下列標籤區段：

### 編輯

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

  選取這個選項，可以在 GHex 視窗十六進制檢視的左邊欄位中，顯示游標偏移量。

### 顯示

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

### 列印

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.