# Manual do usuário para o GHex

## Introdução

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.

## Primeiros passos

### Iniciando o GHex

You can start GHex in the following ways:

Applications menu

- Choose Accessories Hex Editor.

Linha de comando

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

### Abrindo um arquivo

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:

Barra de menu

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

A coluna de deslocamentos do cursor

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

Caixa de diálogo de conversão de tipo

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

## Uso

### Editando um arquivo

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 ghex-prefs-editing tabbed section of the Preferences dialog.

### Salvando um arquivo

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.

### Revertendo para a última versão salva de um arquivo

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. Clique em Localizar anterior para localizar a ocorrência anterior da expressão de busca.

6. Click Cancel to close the Find Data dialog.

### Efetuando uma busca avançada

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 ghex-search-criteria-add.

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

4. Clique em Localizar anterior para localizar a ocorrência anterior da expressão de busca.

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.

### Buscando e substituindo dados em um arquivo

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.

### Visualizando uma tabela de caracteres

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. Efetue uma das seguintes ações:

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

### Mostrando ou ocultando o diálogo de conversão de tipo

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

A caixa de diálogo de conversão de tipo também contém as seguintes opções:

Mostrar decodificação little endian

- Selecione esta opção para mostrar decodificação little endian.

Mostrar números sem sinal e flutuantes como hexadecimal

- Selecione esta opção para mostrar números sem sinal e flutuantes na forma hexadecimal.

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

## Preferências

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

- ghex-prefs-editing

- ghex-prefs-display

- ghex-prefs-printing

### Edição

Número máximo de níveis a desfazer

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

Mostrar deslocamento do cursor na barra de status como

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

Mostrar coluna de deslocamentos

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

### Exibição

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.

Tipo padrão do grupo

- 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

### Impressão

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.

Imprimir caixa sombreada sobre

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