を使用dd
してファイルを切り捨てるか、hexer
編集して破損を引き起こすようなバイナリエディターを試してください。
ddを使用してファイルを切り捨てる例
5MBファイルを作成
# dd if=/dev/zero of=foo bs=1M count=5
5+0 records in
5+0 records out
5242880 bytes (5.2 MB) copied, 0.0243189 s, 216 MB/s
# ls -l foo
-rw-r--r-- 1 root root 5242880 Aug 12 20:13 foo
#
末尾から10バイトを切り捨てます
# dd if=foo of=foo-corrupted bs=1 count=5242870
5242870+0 records in
5242870+0 records out
5242870 bytes (5.2 MB) copied, 23.7826 s, 220 kB/s
# ls -l foo foo-corrupted
-rw-r--r-- 1 root root 5242880 Aug 12 20:13 foo
-rw-r--r-- 1 root root 5242870 Aug 12 20:14 foo-corrupted
#
ヘクサーのマニュアルページ
HEXER(1) General Commands Manual HEXER(1)
NAME
hexer - binary file editor
SYNOPSIS
hexer [options] [file [...]]
DESCRIPTION
hexer is a multi-buffer editor for viewing and manipulating binary files. It can't
(shouldn't) be used for editing block devices, because it tries to load the whole file into
a buffer (it should work for diskettes). The most important features of hexer are: multi
buffers, multi level undo, command line editing with completion, binary regular expressions
(see below). The user interface is kept similar to vi, so if you know how to use vi,
you'll get started easily.