1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

busybox ashで任意の値(0x00~0xFF)で埋めた任意サイズのファイルを作成する

Last updated at Posted at 2024-05-13
head -c N /dev/zero | tr '\x00' '\xHH' > FILE
  • \xHH \x00~\xffで16進数値を指定
  • N : サイズ(byte)
  • FILE : 出力先

おまけ

既存のファイルのサイズを変えずに任意の値でフィルする

head -c $(wc -c < FILE ) /dev/zero | tr '\x00' '\xHH' > FILE

サイズ指定の箇所で既存ファイルのサイズを取得しているだけ。

フレームバッファを埋める場合はサイズ指定なしで大丈夫

tr '\x00' '\xHH' < /dev/zero > /dev/fb0

参考文献


誰か、imagemagickなど無いbusybox ashで/dev/fb0に24bitフルカラー任意色を書き込むワンライナーがあったら教えてください...

1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?