いつも長くなってしまうので今回は短くコンパクトにいきます。今回はmacOSのqlmanageコマンドです(Windows/Linuxには標準でqlmanageに相当するコマンドはありません)。
qlmanageはmacOSに古くからあるコマンドでQuickLookのコマンドライン版です。

今回もこれまでと同じようにデスクトップ上にあるsampleディレクトリを利用します。sampleディレクトリがデスクトップ上にない場合はmkdir ~/Desktop/sampleのようにコマンドラインで作成するか、GUIでフォルダとして作成してください。あとはcd ~/Desktop/sampleのようにコマンドを入力して作成したsampleディレクトリをカレントディレクトリとします。

○qlmanageコマンドのオプション

 qlmanageコマンドはqlmanage -hとするか何もパラメーターを指定しない場合にヘルプが表示されます。qlmanageは古くからありますが、ここでは10.6.8と15.6のqlmanageコマンドのヘルプの結果を示します。新しいバージョンではデバッグレベルを指定する-dが削除され、-Fが追加されています。とは言え、ほとんど変化がないのでqlmanageコマンドを古いマシンで上手に利用することもできるかもしれません。(サムネールの大量作成など)

------------------------------------------------------------------------------------------
【MacOS 10.6.8】
Usage: qlmanage [OPTIONS] path...
-h Display this help
-r Force reloading Generators list
-r cache Reset thumbnail disk cache
-m [name ...] Display statistics about quicklookd. Stats names:
* plugins Show the generators list
* server Show quicklookd life information
* memory Show quicklookd memory consumption
* burst Show statistics about the last burst
* threads Show concurrent accesses stats
* other Show other information about quicklookd
-d debugLevel Integer between 1-4
-p Compute previews of the documents
-t Compute thumbnails of the documents
-x Use quicklookd (remote computation)
-i Compute thumbnail in icon mode
-s size Size for the thumbnail
-f factor Scale factor for the thumbnail
-z Display generation performance info (don't display thumbnails)
-o dir Output result in dir (don't display thumbnails or previews)
-c contentType Force the content type used for the documents
-g generator Force the generator to use

------------------------------------------------------------------------------------------
【macOS 15.6】
Usage: qlmanage [OPTIONS] path...
-h Display this help
-r Force reloading Generators list
-r cache Reset thumbnail disk cache
-m [name ...] Display statistics about quicklookd. Stats names:
* plugins Show the generators list
* server Show quicklookd life information
* memory Show quicklookd memory consumption
* burst Show statistics about the last burst
* threads Show concurrent accesses stats
* other Show other information about quicklookd
-p Compute previews of the documents
-t Compute thumbnails of the documents
-x Use quicklookd (remote computation)
-i Compute thumbnail in icon mode
-s size Size for the thumbnail
-f factor Scale factor for the thumbnail
-F factor Scale factor for the thumbnail, draw downscaled and compare to 1x
-z Display generation performance info (don't display thumbnails)
-o dir Output result in dir (don't display thumbnails or previews)
-c contentType Force the content type used for the documents
-g generator Force the generator to use
------------------------------------------------------------------------------------------

定番のmanコマンドでqlmanageのマニュアルを表示すると以下のようになります。

man qlmanage

○プレビューを表示する

 それではqlmanageコマンドでファイルのプレビューを表示してみましょう。qlmanageコマンドはいろいろな種類のファイル形式に対応しています。QuickLookでプレビューが表示されるファイルであればqlmanageコマンドでも同様に表示できます。

 まずプレーンテキストファイルの内容を表示してみましょう。これはqlmanageの後に-pを指定し、その後にファイル名(ファイルパス)を指定します。以下の例では1.txtのプレビューが表示されます。プレビューウィンドウを閉じるか、コマンドラインでcontrolキーを押してからCキーを押すと表示が消え終了します。

qlmanage -p 1.txt

マイクロソフトワードファイルの場合は以下のようになります。

qlmanage -p 1.docx

エクセルの場合は以下のようになります。場合によってはうまく表示されないこともあります。Pagesであれば問題なく表示されます。

qlmanage -p 1.xlsx

前回やったEPUB形式の場合、内容は表示されずアイコンのサムネールが表示されます。

qlmanage -p 1.epub

○複数ファイルのプレビューを表示する

 単一のファイルではなく複数のファイルのプレビューも可能です。コマンドラインなのでワイルドカード等を利用することができます。以下のようにすると拡張子がHEICのファイルがプレビューウィンドウに表示されます。
複数のファイルのプレビューの場合でも表示されるウィンドウは1つです。表示を切り替えるにはウィンドウの左上の< >をクリックします。

qlmanage -p *.HEIC

.
編集部おすすめ