2009年7月29日水曜日

ファイルパスをクリップボードにcopy

下記をcpc.shに記述して、保存する。
#!/bin/bash
echo -n `pwd`\/$1 | xsel -b

"cpc.sh ファイル名" でそのファイルのフルパスをクリップボードにcopyしてくれる。

2009年7月21日火曜日

通常出力とエラー出力を別々に出力する

ls ~root ~ > hoge1.txt 2> hoge2.txt
通常出力はhoge1.txtに出力され、エラーはhoge2.txtに出力される。

エラーを通常出力と同じにする場合
"2>&1"を利用する

linux の background 実行

コマンドラインの一番最後に'&'をつけることによって、バックグランドで実行してくれる。
[root@HouTou java]# tar -cjf j2sdk1.4.2_17.tar.bz2 j2sdk1.4.2_17 &
[1] 5125

実行した後、プロセスを確認できる。
[root@HouTou java]# ps | grep 5125
5125 pts/4 00:00:00 tar

終了したら、下記メッセージが出る。
[1]+ 終了 tar -cjf j2sdk1.4.2_17.tar.bz2 j2sdk1.4.2_17

2009年7月19日日曜日

stardict

StarDict更多词典的安装
http://alexandermail.blog.hexun.com/23159549_d.html

可以在官网找到很多的词典

下载你喜欢的词典后只需把它解压到 ~/.stardict/dic 或 /usr/share/stardict/dic

现在以安装文件名为a.tar.bz2 的词典为例:

tar -xjvf a.tar.bz2
sudo mv a /usr/share/stardict/dic

注意:a.tar.bz2是词典文件,a 是解压出来的词典目录

重新启动stardict,新的词典就会被自动加载了。
安装 WyabdcRealPeopleTTS

如果你的源中有该软件包,直接

sudo apt-get install wyabdcrealpeopletts

没有的话,请到wiki_ubuntu_ftp下载后执行

sudo tar -xvf WyabdcRealPeopleTTS.tar.gz -C /usr/share

安装OtdRealPeopleTTS(确保空闲空间>3G)

下载後手动安装

注意:需下载112.3M,安装後会消耗2.9G空间

解压缩,然後执行

sudo apt-get install python mpg321 #先安装python及mpg321
./INSTALL #安装OtdRealPeopleTTS


发音设置

如果您安装的是 ubuntu/gnome, 那么只要安装真人发音包之後不需要任何设置,stardict 就可以发音了。

如果您确认安装的是 statdict-gtk ,并且安装了 sox , 那么无须任何设置就可以发音了, 不过依然推荐修改下让星际译王用 alsa , 启动stardict後,点击主界面右下角按钮进入设置页面 -> 词典 -> 声音 -> 在启用声音前打钩,并将play改为aplay。 改完後如下图所示

2009年7月10日金曜日

linux shortcut keys

CTRL + A Moves the cursor to the head of a line
CTRL + E Moves the cursor to the end of a line
CTRL + R Search a command from the command history.

CTRL + B Moves the cursor backward one character.
CTRL + F Moves the cursor forward one character.
CTRL + D Logs out of the current session.

CTRL + H Erase one character. Similar to pressing backspace.
CTRL + W Deletes the last word typed in. For example, if you typed 'mv file1 file2' this shortcut would delete file2.
CTRL + U Erases the complete line.

CTRL + P Paste previous line and/or lines.
CTRL + N Paste next line and/or lines.

CTRL + S Stops all output on screen (XOFF).
CTRL + Q Turns all output stopped on screen back on (XON).

CTRL + Z Cancels current operation, moves back a directory and/or takes the current operation and moves it to the background. See bg command for additional information about background.