zshで正常に一覧表示しても色を取得する方法[閉じる]

zshで正常に一覧表示しても色を取得する方法[閉じる]

以下のリストをご覧ください -

/home/shirish/games/gtimelog> ls

.   CONTRIBUTORS.rst .gitattributes  gtimelog.appdata.xml help 
org.gtimelog.gschema.xml scripts tox.ini COPYING gitignore gtimelog.desktop locale  other-requirements.txt setup.cfg .travis.yml appveyor.yml .coveragerc gschemas.compiled gtimelog.desktop.in Makefile    po setup.py benchmark.py docs gtimelog gtimelogrc.5 MANIFEST.in README.rst src CONTRIBUTING.rst .git gtimelog.1 gtimelog.rst NEWS.rst runtests TODO.rst

上記では、ファイルとディレクトリの間に色の違いはありません。

しかし、正しい長いリストを使用すると、どちら$ls -laがディレクトリで、どのファイルがファイルであるかを示す色が表示されます。ランダムにリストされていても、ディレクトリの色をリストする方法はありますか?

ベストアンサー1

単に混在色を追加したい場合、多くのGNUプログラムは--colour=autoハイライトを含めるためにこのフラグを受け入れます。

その後、次のコマンドを実行してコマンドに自動的に含めることができます。

alias ls='ls --color=auto'

これは通常 Debian の Bash ですでに行われていますが、ZSh ではまだ行われていない可能性があります。

おすすめ記事