9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

クソデカログを生成するコマンド

Last updated at Posted at 2021-08-26

はじめに

先日、クソデカログを生成したくなったので方法を共有します。

各行の文字列が同じでも良い場合

head のオプション -n 10 が行数を表してます。10をクソデカ数に書き換えてください

$ yes | head -n 10
y
y
y
y
y
y
y
y
y
y

ファイルに保存したい場合は次のようにしましょう。

$ yes | head -n 10 > kusodeka.log

各行の文字列がランダムであってほしい場合

fold のオプション -w 20 が 1行の文字数、head のオプション -n 10 が行数を表してます。

1行をクソ長にしたい場合は20をクソデカ数に、行数をクソデカにしたい場合は10をクソデカ数に書き換えてください

$ cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w 20 | head -n 10
zQrYUcA346KBl2EoJdaw
N7JSAh63K2woc0N3gguM
uQoYadLuyfkIX5V1rpSW
Eg16Q8WjSFU4Ye3llGg5
7yuxuhURaAQDDONMusMX
4r4ILD2FkQxyFotFA49k
NXOZZ6Jx8odFZUYWMbvN
1cdR2f7qZyoaqJhY2LKf
8gpQpbEaCIoncgyXObAV
dx4DcR0sBIOrIMOf9bs1

ファイルに保存したい場合は次のようにしましょう。

$ cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w 20 | head -n 10 > kusodeka.log

各行の文字列がランダムであってほしい場合 Part2(2021/08/27追記)

trのところはbase64を使ってもできるみたいですね。

$ cat /dev/urandom | base64 | fold -w 20 | head -n 10 
KfV9Hp9HBS2VAjTEcyNS
ZdgHQlTHtJo+SQVb3rBm
nhFUvy4T/WLCT27MRgMT
k+VC78GKFvmM/51WlxLR
D/X+OBas/B8lVjC+mI4e
r8pQbYinxcSZGo52eVCL
eJN7g7j0ebYOetZ8N21L
6rAkZbOCn65gIghtkxcp
yg0F+y7IGJkc8YvWgTUm
sWRs2RzXRNG4RHVi5Otk

参考

9
4
0

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
9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?