Rename garbled file name

On Linux, when you extract compressed files created on Windows, (especially with application developed by Japanese speakers) Japanese characters in file name are garbled. You can’t rename or delete them via file browser (like dolphin or nautilus) in usual way, so you have to rename it via command line.

First, move on to the directory which garbled file is included. In my case, files are included under /home/phanect/

$ > cd /home/phanect

Then, execute “ls” command with “-i”option.

$ > ls -i

294930 ???J?p?@archive??     294913 bin              286741 Download
319490 Documents             286820 Templates       303105 public_html
303106 Desktop

You can see numbers before the file name. This is named inode number. You can specify the file instead of the file name with it. This time, we want to delete “???J?p?@archive??” so we use “294930

Next, use find command.

$ > find /home/phanect -inum 294930

./???J?p?@archive??

With this command, you can get file name specified by inode number.
The first argument “/home/phanect” is the directory including garbled file.
And specify inode number with “-inum” option. 294930 is the inode number of garbled file in this case.

Can you see the file name which you want to rename?

Now, let’s rename it.
You can execute desired command to the file with find command.

$ > find  /home/phanect -inum 294930 -exec [command] \;

You can write command between “-exec” and “\;”

(“\;” means the end of the command. More details for Wikipedia.)

Well, in this case, you want to execute following command:

$ > mv ???J?p?@archive?? new_file_name.txt

Of course this doesn’t work because file name is garbled.

So instead you have to execute:

$ > find  /home/phanect -inum 294930 -exec mv {} new_file_name.txt \;

{} means the file name. (“???J?p?@archive??”) In this case, file is not specified with file name but inode number, so renaming is safely done.

Where is applications list of Kickoff?

Applications list is saved at “/home/jrillet/.config/menus/applications-kmenuedit.menu”
This is an XML file.
This XML file is just a list. Only *.desktop file names are listed here.

The category (Internet, Graphics, Multimedia etc.) information files are under “/usr/share/desktop-directories/”.
The applications information files are under “/usr/share/applications/”
Note that KDE applications are under “/usr/share/applications/kde4″

Refferences:
How to edit Kickoff menu manually
KDE menu category associations – KDE Community Forums

Linux で Google Chrome のウィンドウバーを表示しない


Linux では、以下のように Google Chrome のウィンドウバーが表示されるようになっています。

これを隠すには、オプションを開き、個人設定タブの一番下にある「システムタイトルバーを隠してコンパクトな枠線を使用する」を選択します。

これで、以下のように、Windows と同じようなウィンドウバーの表示になります。

KlamAV で Encrypted.Zip の原因により暗号化された ZIP ファイルが隔離される

ClamAV のGUI フロントエンドである KlamAV では Encrypted.Zip という原因で、問題がないファイルが隔離されます。これは、デフォルトで暗号化されたファイルを脅威とみなす設定になっているからです。

ClamAV 自体の設定では、デフォルトでは暗号化されたファイル即脅威とみなす設定にはなっていません。(参考: KSKNET)しかし KlamAV は、これに関する ClamAV の設定を無視します。

設定方法は以下の画像の通りです。

Scan タブ -> Launcher タブ -> Options タブ

以下のダイアログが表示されますので、File Types を押し、Mark Encrypted Files as Suspicious のチェックを外す。
※知っている人も多いと思いますが、バツ印が付いている状態がチェックされている状態です。

ちなみに本題とは関係ありませんが、Treat a Broken Executable as a Virus (壊れた実行可能ファイルをウイルスとして扱う) のチェックも外しておいたほうがいいと思います。

Linux 版 Thunderbird で URL リンクをクリックしてもブラウザが起動しない問題

openSUSE に入れていた Thunderbird で、メール本文中のURLや、購読している RSS の本文 URL をクリックしてもブラウザが起動しないということがあったのですが、これを解決する方法について openSUSE の日本語 ML へ投稿があったので、ここで紹介します。

[編集] -> [設定] -> [詳細] -> [一般] タブ -> [設定エディタ]を開き、その中に

network.protocol-handler.warn-external.http
network.protocol-handler.warn-external.https

の二つの項目がありますので、これらをダブルクリックして、値を true に変更します。
その後、URL をクリックするとどのアプリケーションで開くかを聞いてきますので、これにブラウザのファイルを指定します。Firefox の場合は “/usr/lib/firefox/firefox.sh” を指定します。

Linux での プログラムファイルの場所

未だに Linux において RPM でインストールしたプログラムがどのディレクトリに配置されるのかよく知らなかったのですが、Installing software from RPM packages in linux  の < Installing and upgrading RPM packages > によると、

Executable programs go usually into /bin, /usr/bin, /usr/X11/bin, or /usr/X11R6/bin after installing with rpm.

とあります。Windows のように特定のディレクトリにまとめられているわけではないようです。

Firefox を探してみますと、”/usr/bin” 以下に “firefox” というリンクがあり、このリンク先は “/usr/lib/firefox/firefox.sh” です。これをクリックすると Firefox が起動します。

Unix でファイル名が文字化けしたファイルを削除する

Windows で作成された圧縮ファイルを展開しようとすると、unzip のバグで、ファイル名が文字化けしてしまいます。文字化けしたファイルを削除するための方法を紹介します。

参考資料
CentOSサーバ構築術 文具堂
UNIXの部屋

まず、-i オプションをつけて ls コマンドを実行します。

$ > ls -i [削除したいファイルのあるディレクトリのパス]
294930 ???J?p?@archive??     294913 bin                  286741 ダウンロード
319490 ドキュメント                       286820 Templates     303105 public_html
303106 デスクトップ

すると、 ファイル名の前に番号が付いています。
これは i-node 番号 というもので、ファイル名の代わりに、これでファイルを特定することが可能です。今回削除したいのは “???J?p?@archive??” ですので、このi-node 番号 “294930″ を使います

次に find コマンドで、以下の様に入力します。(-inum の後の番号は、削除したいファイルの i-node 番号)

$ > find [削除したいファイルのあるディレクトリのパス] -inum 294930
 ./???J?p?@archive??

出力結果が削除したいファイルであることを確認したら、以下の様に入力して、件のファイルを削除します。

$ &gt; find [削除したいファイルのあるディレクトリのパス] -inum 294930 -exec rm -rf -d {} \;

-exec 以降に、削除コマンドを記述します。つまり、

rm -rf -d {} \;

が削除コマンドです。
rm は、ファイルを削除するためのコマンドですが、
-rf オプションは、強制的に削除するためのオプションです。
今回は、削除したいファイルがディレクトリなので、 -d オプションを付けています。

{} は、検索した結果のファイルが入ります。つまり、
$ > find [削除したいファイルのあるディレクトリのパス] -inum 294930
とした時の出力結果です。今回の場合は “./???J?p?@archive??” です。

最後の “\;” はよく分からなかったのですが、 “\” はエスケープシーケンスのようです。
“;” は、一般的には複数のコマンドを区切るためのものですが…。
とりあえずつけておいた方が良さそうです。

Linux でのバックアップ − rsync

Linux でのバックアップは rsync というコンソールプログラムが有名みたいですね。使ってみました。解説はこちらのページが詳しいです。

ホームディレクトリにあるファイルをすべて '/media/USBHDD/SuSEBackUp' にバックアップしてみましょう。

rsync '/home/[user name]/' '/media/USBHDD/SuSEBackUp'

※ ‘ ‘ でパスを括っておくと、空白を含むディレクトリ名がある時に問題が起こらないので、いいと思います。

…ん?

結果:
Skipping Directory .

えーと…あ、こうすればいいのですね。

rsync -r '/home/[user name]/' '/media/USBHDD/SuSEBackUp'

-r オプションをつけないと、フォルダ以下のファイルがバックアップされないのですね。

Wine にインストールしたソフトウェアを削除するには

Wine にインストールしたソフトウェアを削除する方法です。Wine 付属のアンインストールプログラム(Windows XP の「プログラムの追加と削除」と似たもの)を用います。

これを起動するには、端末で

uninstaller

とコマンドを打ちます。(ディストリビューションによってはメニューからも起動できるようです。もしかしたら openSUSE でもそうなのかも知れませんが…)
すると、以下のような画面が現れます。

アンインストールしたいアプリケーションを選択した上で、右下の「追加と削除(R)」を押すと、アンインストールプログラムが立ち上がります。

以上、普通にググれば日本の Google でも出てくる情報。書いた意味なしorz

なお、openSUSE ではこれを実行しただけでは、アプリケーションブラウザからアイコンが削除されません。 後ほど記事を上げます。(本当はこっちの解決策をここで書くつもりでした)