echoコマンド
echoで改行しない
[root@water0 ~]# echo test
test
[root@water0 ~]# echo -n test
test[root@water0 ~]#
echoで特殊文字を使用
[root@water0 ~]# echo "test\ttest"
test\ttest
[root@water0 ~]# echo -e "test\ttest"
test test
ddコマンド
テストデータ(50M)の作成
[root@water0 ~]# dd if=/dev/zero of=/tmp/50mb bs=1000 count=50000
50000+0 records in
50000+0 records out
50000000 bytes (50 MB) copied, 0 seconds, Infinity B/s
[root@water0 ~]# ll /tmp/
-rw-r--r-- 1 root root 50000000 5月 9 15:05 50mb
nkfコマンド
- iconvコマンド:世界的に使用されている。自動判別機能がない。
- kccコマンド:UTF-8をサポートしていない。
文字コードを調べる
[root@water0 ~]# nkf -g /var/www/index.html
ASCII
文字コード変換
shift-jis・windows形式(CRLF)
[root@water0 ~]# nkf -s -Lw /tmp/test/index.html
utf-8・unix改行形式(LF)
[root@water0 ~]# nkf -w -Lu /tmp/test/index.html
①--overwriteオプションを付ける。(上書き注意)
②nkf (-j -s -e -w w16) ファイル名 > ファイル名で可能。
③一度WinSCPで落して保存するときに文字コードを選ぶ。
最終更新:2010年05月09日 16:39