That's a feature of the ls
utility in GNU coreutils. It doesn't depend on the shell. The syntax is not documented (you're supposed to use dircolors
and figure it from there), but a quick look at the source shows that the only way to match files by name is to use *
followed by a string which must be a suffix for a file name to match. The string is interpreted literally, except that \
and ^
introduce escape sequences (e.g. \n
= ^J
= newline).
So you can't match different extensions with the same pattern. But you can use shell programming constructs to build LS_COLORS
:
for ext in jpg gif; do LS_COLORS="$LS_COLORS:*.$ext=38;5;220"; done
There is some information on 256-color support in the tmux FAQ.
Detecting the number of colors that the terminal supports is unfortunately not straightforward, for historical reasons. See Checking how many colors my terminal emulator supports for an explanation. This means that
- tmux cannot reliably determine whether the terminal supports more than 8 colors;
- tmux cannot reliably communicate to the application that it supports more than 8 colors.
When you're in tmux, the terminal you're interacting with is tmux. It doesn't support all of xterm's control sequences. In particular, it doesn't support the OSC 4 ; …
control sequence to query or set color values. You need to use that while directly running in xterm, outside tmux.
If you run tmux -2
, then tmux starts with 256-color support, even if it doesn't think that your terminal supports 256 colors (which is pretty common).
By default, tmux advertises itself as screen
without 256-color support. You can change the value of TERM
in .tmux.conf
to indicate 256-color support:
set -g default-terminal "screen-256color"
You can use TERM=xterm-256color
or TERM=screen-256color
on Ubuntu. These values will only cause trouble if you log in to a remote machine that doesn't have a termcap/terminfo entry for these names. You can copy the entries to your home directory on the remote machine; this works with most modern terminfo implementations.
# From the Ubuntu machine to a machine that doesn't have *-256color terminfo entries
ssh somewhere.example.com mkdir -p .terminfo/s .terminfo/x
scp -p /lib/terminfo/s/screen-256color somewhere.example.com:.terminfo/s/
scp -p /lib/terminfo/x/xterm-256color somewhere.example.com:.terminfo/x/
Best Answer
If you're only sorting by name, this might help:
However, it splits the ls command in two parts, one for hidden files and folders, one for the rest.