GhaSShee


File of Binary


# completely clear data ~~~ dd if=/dev/zero of=destination bs=4096 count=16 ~~~

# MBR partition table MBR : MasterBootRecord ~~~ od -t x1 -Ax ~~~ ~~~ -t x1 : 1バイト毎に表示(リトルエンディアンでも同じ) -t x2 : 2バイト毎に表示 -Ax : アドレスを16進表示 ~~~ ~~~ 0 :0000 1 :0001 2 :0010 4 :0100 8 :1000 9 :1001 a :1010 b :1011 c :1100 d :1101 e :1110 f :1111 ~~~ partition table \#1 ~~~ 80 00 01 00 00 3f e0 c3 00 00 00 00 00 20 1 e 00 ~~~ e0 : 11 100000 c3 : 11000011

# Edit Binary Text (vi, xxd) see "ls" exec file ~~~ $ cp /bin/ls . $ vi -b ./ls :%!xxd 0000000: cffa edfe 0700 0001 0300 0080 0200 0000 ................ 0000010: 1300 0000 1807 0000 8500 2000 0000 0000 .......... ..... 0000020: 1900 0000 4800 0000 5f5f 5041 4745 5a45 ....H...__PAGEZE 0000030: 524f 0000 0000 0000 0000 0000 0000 0000 RO.............. 0000040: 0000 0000 0100 0000 0000 0000 0000 0000 ................ 0000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000060: 0000 0000 0000 0000 1900 0000 2802 0000 ............(... 0000070: 5f5f 5445 5854 0000 0000 0000 0000 0000 __TEXT.......... ~~~ - このまま保存しないように - 編集が終わったら元のバイナリに変換して保存する ~~~ :%!xxd -r :wq ~~~

# 運用にかかわるコマンド pgrep : processName -> pid ~~~ $ pgrep "name" pid ~~~ uptime : サーバ稼働時間を見る ~~~ $ uptime ~~~ dd : path -> Backup() ~~~ $ dd ~~~ pkill : processName -> kill pid ~~~ $ pkill "name" ~~~ ~~~ 複数のサーバマシンに連続してコマンドを実行する (dsh) 環境変数を一時的に変更してプログラムを実行する (env) コマンドに別名をつける (alias, unalias) 定期的に状態を監視する (watch) ファイルやディレクトリを差分バックアップする (rsync) rsyncで帯域制限をかける (rsync bwlimit) ~~~