Linuxメモ : lsに色、アイコンを付けて表示するRust製のlsdを試してみる
lsd
lsdコマンド(ls deluxeの略らしい)は図のような色、アイコン付きのlsコマンド。
特徴としてはRust製なので高速とのこと(比較対象はRuby製のcolorlsとRust製のexa)。

| Command | Mean [ms] | Min…Max [ms] |
|---|---|---|
lsd -la /etc/* |
9.8 ± 0.7 | 8.6…11.9 |
colorls -la /etc/* |
387.3 ± 4.1 | 379.8…393.6 |
exa -la /etc/* |
15.4 ± 1.8 | 14.0…24.0 |
インストール
前提条件としてREADMEに書いてあるようにアイコン表示のためにフォントの設定が必要。
Install the patched fonts of powerline nerd-font and/or font-awesome. Have a look at the Nerd Font README for more installation instructions. Don't forget to setup your terminal in order to use the correct font.
各環境でのインストール方法はこのページに書いてある。
バイナリはこのページからダウンロードでき、 Rust製なのでcargo installでインストールできる。
$ cargo install lsd
ヘルプメッセージ。
$ lsd --help
lsd 0.12.0
An ls comment with a lot of pretty colors and some other stuff.
USAGE:
lsd [FLAGS] [OPTIONS] [--] [FILE]...
FLAGS:
-a, --all Do not ignore entries starting with .
-h, --help Prints help information
-F, --classify Append indicator (one of */=>@|) at the end of the file names
-l, --long Display extended file metadata as a table
-1, --oneline Display one entry per line
-R, --recursive Recurse into directories
-r, --reverse Reverse the order of the sort
-t, --timesort Sort by time modified
--tree Recurse into directories and present the result as a tree
-V, --version Prints version information
OPTIONS:
--color <color>... When to use terminal colours [default: auto] [possible values: always, auto, never]
--date <date>... How to display date [default: date] [possible values: date, relative]
--depth <num> Stop recursing into directories after reaching specified depth
--group-dirs <group-dirs>... Sort the directories then the files [default: none] [possible values: none, first, last]
--icon <icon>... When to print the icons [default: auto] [possible values: always, auto, never]
--icon-theme <icon-theme>... Whether to use fancy or unicode icons [default: fancy] [possible values: fancy, unicode]
ARGS:
<FILE>... [default: .]
使い方
lsコマンドのように使えるのでalias ls='lsd'エイリアスを設定するのがよいかも。

--treeでツリー表示。

更新日時順のソートも可能。

date=relativeで更新日時の相対表示。
