Return to the Sintran homepage Return to your previous page

Norsk Data & Sintran Data software1.5.9.1 - hex


hex

Hex is a tiny tool to make a hex dump of any file, in fact it has options to make hex, dec, oct and a special ND oct dumps.

hex screen dump

Options

The wanted action is given as options on the command line, hex will not ask for any (missing) options/parameters but display an error message instead. Some options are mandatory, others are optional. The options are processed strictly from left to right, but when the action is executed depends on the type of option.

Some options are just switches that turns on/off features used by other options. Others have an an immediate action, while others are postponed until all options are parsed. Not all combinations of options are legal, and some options turn off options that cannot be used together.

-? - Display help/usage screen

Display the help/usage screen show above.
D:\>hex -?
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Usage:
  hex {options} {file(s)}

Options available:
  -?       - Display help/usage screen         - Default: Off
  -a       - Ascii dump                        - Default: On
  -f{file} - Input file name                   - Default: Off
:

-a - Ascii dump

Toggles the adding of the ASCII part in the dump.
D:\>hex -a file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Hex dump of 2DH (45) bytes from the file file.txt
00: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74
20: 68 65 20 6C 61 7A 79 20  64 6F 67 0D 0A

hex version B01 - Exit

-f{file} - Input file name

This is the main work for this tool. The option must be followed by a file name either like this -ffile.txt or -f file.txt. The -f option is normally not necessary as it is implied when a file name is found. It can however be useful when f.eks. your file name starts with a minus ('-') to avoid that it is mistaken for an option. If your file name is '-myFile.txt' you can use the -f option like this -f-myFile.txt or you can do it like this .\-myFile.txt then avoiding the minus as the first character.
D:\>hex -f file.txt
or just
D:\>hex file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Hex dump of 2DH (45) bytes from the file file.txt
00: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20 : the quic k brown
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74 : fox jump s over t
20: 68 65 20 6C 61 7A 79 20  64 6F 67 0D 0A          : he lazy  dog..

hex version B01 - Exit

-h - Header

Turns off/on the headers which are normally present in the table dumps.
D:\>hex -h file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

00: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20 : the quic k brown
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74 : fox jump s over t
20: 68 65 20 6C 61 7A 79 20  64 6F 67 0D 0A          : he lazy  dog..

hex version B01 - Exit

-n{x} - Number format (hex, dec, nd, oct)

Change the number base to another than the default hex notation.
D:\>hex -nh file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Hex dump of 2DH (45) bytes from the file file.txt
00: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20 : the quic k brown
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74 : fox jump s over t
20: 68 65 20 6C 61 7A 79 20  64 6F 67 0D 0A          : he lazy  dog..

hex version B01 - Exit
D:\>hex -nd file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Dec dump of 45 bytes from the file file.txt
 0: 116 104 101  32 113  117 105  99 107  32 : the q uick
10:  98 114 111 119 110   32 102 111 120  32 : brown  fox
20: 106 117 109 112 115   32 111 118 101 114 : jumps  over
30:  32 116 104 101  32  108  97 122 121  32 :  the  lazy
40: 100 111 103  13  10                      : dog..

hex version B01 - Exit
D:\>hex -no file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Oct dump of 55B (45) bytes from the file file.txt
00: 164 150 145 040  161 165 151 143 : the  quic
10: 153 040 142 162  157 167 156 040 : k br own
20: 146 157 170 040  152 165 155 160 : fox  jump
30: 163 040 157 166  145 162 040 164 : s ov er t
40: 150 145 040 154  141 172 171 040 : he l azy
50: 144 157 147 015  012             : dog. .

hex version B01 - Exit
D:\>hex -nn file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Oct ND dump of 55B (45) bytes from the file file.txt
000000B: 164 150 145 040 161 165 151 143 153 040 142 162 157 167 156 040 : the quick brown
000020B: 146 157 170 040 152 165 155 160 163 040 157 166 145 162 040 164 : fox jumps over t
000040B: 150 145 040 154 141 172 171 040 144 157 147 015 012             : he lazy dog..

hex version B01 - Exit

-o{file} - Output file name

This redirects the output to a file instead of to the display. The -o option may be followed by a file name, which will be overwritten if it already exists. It can not be the same as the input file, the input file will be corrupted (empty). In the case where no file name is given, hex will create a file name automatically. This autogenerated file name will always be the same as the input file name with the extension .hex appended. Here, the -f option turn out to be very useful, to prevent your input file from being unintentionally used as the output file.

In this example the output file will be automatically created with the name file.txt.hex and contains the hex dump of the file.txt.
D:\>hex -o -f file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

hex version B01 - Exit

-s - Statistics

Print some statistics data at the end of a file operation.
D:\>hex -s file.txt
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Hex dump of 2DH (45) bytes from the file file.txt
00: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20 : the quic k brown
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74 : fox jump s over t
20: 68 65 20 6C 61 7A 79 20  64 6F 67 0D 0A          : he lazy  dog..

Input info
File name     : file.txt
File size     : 2DH (45) bytes (45 bytes)
Dump format   : hex
Suppress zeros: No

Output info
File name     : stdout
File size     : 109H (265) bytes (265 bytes)
Time used     : 0.015 seconds

hex version B01 - Exit

-v - Verbose mode

Toggles the verbose mode.
D:\>hex -v -?
Usage:
  hex {options} {file(s)}

Options available:
  -?       - Display help/usage screen         - Default: Off
  -a       - Ascii dump                        - Default: On
  -f{file} - Input file name                   - Default: Off
:

-vv - Very verbose mode

Toggles the very verbose mode.
D:\>hex-b01 -vv -?
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

DosLibrary version C02 - 2021.01.09 (ND-291057 - 3.2.2.7) - Copyright (C) 2014-2021, Sintran Data

hex is a small utility to make a hex dump of any file.

Usage:
  hex {options} {file(s)}

Options available:
  -?       - Display help/usage screen         - Default: Off
  -a       - Ascii dump                        - Default: On
  -f{file} - Input file name                   - Default: Off
:

Redirections and pipes

This utility can be used with the redirect features and pipes available in DOS.

Redirect both the input and the output.
D:\>hex < file1.txt > file2.txt
Using pipes.
D:\>echo the quick brown fox jumps over the lazy dog | hex
hex version B01 - 2021.01.16 (ND-291090 - 2.1.1.276) - Copyright (C) 2018-2021, Sintran Data

Hex dump from the standard input
0: 74 68 65 20 71 75 69 63  6B 20 62 72 6F 77 6E 20 : The quic k brown
10: 66 6F 78 20 6A 75 6D 70  73 20 6F 76 65 72 20 74 : fox jump s over t
20: 68 65 20 6C 61 7A 79 20  64 6F 67 20 0A          : he lazy  dog .

hex version B01 - Exit

Download

ND noProductLanguageReleaseTitleDownloadFilesSizeMD5SUM
291090B01hexENJan. 2021Hex dump utilityZIP file114 KB4EEDDEB5FA984EC24E240F5CDCC62D13

Version history


This page was last updated 27. Jan. 2025
Copyright © Sintran Data
../valid HTML code ../valid CSS code
Mail us