我想在带有macos bash shell的颜色亮点的列中查看 ls
的输出。
颜色
ls -GFS # gives colorful output of one column
列
ls | paste - - - # gives 3 columns without hightlight
我们如何使其既有彩色和3列?
如果我可以发挥功能并放入.bash_profile
,那就太好了每当我做lss
时,我都可以在3列中看到输出列表。
例如:
alias lss='ls -GFS'
update
ls -GFS | paste - - - # This gives 3 columns but no hightlight
ls -GFS # this gives one column with hightlight
您可以强迫MacOS LS通过设置CLICOLOR_FORCE
:
CLICOLOR_FORCE=1 ls -GFS | cat
gnu ls的等效物为:
ls --color=always | cat
但是,请注意,MacOS ls -GFS
将自动调整适合文件名和终端宽度的列数:
bash-3.2 $ ls -GFS
a pretty long filename
an even longer filename that takes up half the terminal
file1*
file2*
file3*
bash-3.2 $ rm an even longer filename that takes up half the terminal
bash-3.2 $ ls -GFS
a pretty long filename file2*
file1* file3*
bash-3.2 $ rm a pretty long filename
bash-3.2 $ ls -GFS
file1* file2* file3*