Cloud (OpenStack)用のCentOSイメージ

OpenStackのページ や そこからの CentOSのダウンロードページから、取得可能。

ログインユーザ: centos
で、起動時に登録した公開キーでsshログインできる。

awkで正規表現にマッチする箇所のみを取り出して利用する例

match()を使うと、マッチした部分文字列のインデックスと長さが、RSTARTとRLENGTHに入る。それをsubstrで切り出す。
ls | awk '{ match($0, "#[0-9]+"); if (RSTART > 0) printf("cp \"%s\" file-%03d.dat\n", $0, substr($0, RSTART+1, RLENGTH)) }' 

How to create a network packet capture file by tcpdump, which can be available for Wireshark

Example: File name (blue characters) should be changed properly.
# tcpdump -n -s 0 -i eth0 -w dump.dat
-n: Shows the raw IP address (doesn't resolve the name with DNS).
-s 0: Makes the maximum packet size unlimited.
-i: Network device used for the capture.
-w: File name captured packets will be stored in.


Japanese version is here

sshfsでリモートマシンのディレクトリをマウント

リモートマシンremoteの/homeを/mnt/dir1にマウントする例。
sshfs remote:/home /mnt/dir1
リモートマシンremoteのホームディレクトリを、相対パスmntにマウントする例。
sshfs remote: mnt
アマウントの例
fusermount -u mnt

LinuxでDVDのバックアップ例

$ dvdbackup -i /dev/sr0 -M
libdvdread4が必要な場合、/usr/share/doc/libdvdread4/install-css.shを実行する。

-i で入力デバイスを指定。
-M でコピー(Mirror)を実行する。

lxcのインスタンスにカーネルログを記録させない

ゲストOSでrsyslogが動作している場合、次のように設定ファイルにkern.noneを/var/log/syslogの行に追加する。 また、kern.log行そのものをコメントアウトします。
*.*;auth,authpriv.none,kern.none -/var/log/syslog
#kern.*                          -/var/log/kern.log
Ubuntu 14.04の場合、/etc/rsyslog.d/50-default.confが設定ファイルです。