Листинг файлов одинакового типа с помощью команды ls может создавать файлы с разными цветами

Здесь уже даны ответы, которые также мне очень помогли. Я использую текстовый режим ubuntu 16.04, поэтому

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nomsi"

мне не помог. Здесь я изменил - (в /etc/default/grub)

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nomsi"
GRUB_CMDLINE_LINUX="text pci=nomsi"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

, который решил мою ошибку (ПРИМЕЧАНИЕ. Я использовал только pci=nomsi, и в случае, если он не работает, другая опция pci=noaer), которые могут помочь решить любой, кто сталкивается с той же ошибкой.

0
задан 10 April 2018 в 22:18

4 ответа

Цвета контролируются переменной окружения LS_COLORS.

На странице man ls указано:

LS_COLORS The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color. The color designators are as follows: a black b red c green d brown e blue f magenta g cyan h light grey A bold black, usually shows up as dark grey B bold red C bold green D bold brown, usually shows up as yellow E bold blue F bold magenta G bold cyan H bold light grey; looks like bright white x default foreground or background Note that the above are standard ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use. The order of the attributes are as follows: 1. directory 2. symbolic link 3. socket 4. pipe 5. executable 6. block special 7. character special 8. executable with setuid bit set 9. executable with setgid bit set 10. directory writable to others, with sticky bit 11. directory writable to others, without sticky bit The default is "exfxcxdxbxegedabagacad", i.e. blue fore- ground and default background for regular directories, black foreground and red background for setuid executa- bles, etc.
0
ответ дан 17 July 2018 в 17:05

Файл WhiterShadePale1.jpg имеет разрешения на выполнение. Вот и все. Исполняемый цвет переопределяет цвет * .jpg.

2
ответ дан 17 July 2018 в 17:05

Цвета контролируются переменной окружения LS_COLORS.

На странице man ls указано:

LS_COLORS The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color. The color designators are as follows: a black b red c green d brown e blue f magenta g cyan h light grey A bold black, usually shows up as dark grey B bold red C bold green D bold brown, usually shows up as yellow E bold blue F bold magenta G bold cyan H bold light grey; looks like bright white x default foreground or background Note that the above are standard ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use. The order of the attributes are as follows: 1. directory 2. symbolic link 3. socket 4. pipe 5. executable 6. block special 7. character special 8. executable with setuid bit set 9. executable with setgid bit set 10. directory writable to others, with sticky bit 11. directory writable to others, without sticky bit The default is "exfxcxdxbxegedabagacad", i.e. blue fore- ground and default background for regular directories, black foreground and red background for setuid executa- bles, etc.
0
ответ дан 23 July 2018 в 17:56
  • 1
    Я думаю, что вы получили это из справочной системы BSD, вызывают Ubuntu, LSCOLORS не используется. Вместо этого это LS_COLORS, который имеет совершенно другую структуру. – wjandrea 10 April 2018 в 23:23
  • 2
    Ты прав. Позвольте мне обновить. Похоже, что страница руководства Ubuntu не содержит подробностей о том, как она работает как BSD, но поскольку это от GNU coreutils, это не имеет значения. – tk421 11 April 2018 в 00:29
  • 3
    askubuntu.com/questions/466198/… подробнее. Существует еще одна команда dircolors (1) - manpages.ubuntu.com/manpages/xenial/en/man1/dircolors.1.html , которая может использоваться для установки цветов. – tk421 11 April 2018 в 00:42
  • 4
    Ваше обновление не устранило проблему. Дело не только в том, что переменная имеет другое имя, а в том, что она имеет совершенно другую внутреннюю структуру: это список с разделителями с двоеточием пар типа = цвета. – wjandrea 11 April 2018 в 00:52

Файл WhiterShadePale1.jpg имеет разрешения на выполнение. Вот и все. Исполняемый цвет переопределяет цвет * .jpg.

2
ответ дан 23 July 2018 в 17:56
  • 1
    Я знаю, что это отображается как исполняемый файл, но почему? Это не программа. Это только файл изображения, как показано на других. – Paul Benson 10 April 2018 в 22:52
  • 2
    Он показан как excecutable, потому что это исполняемый файл. Причина для этого может быть много, но это явно неправильный флаг выполнения, установленный в этом конкретном файле. Кстати, ls с цветами часто помогает идентифицировать такие проблемы с разрешениями. – Sebastian Stark 10 April 2018 в 22:59
  • 3
    @PaulBenson Имеет разрешения на выполнение. Если вы запустите ls -l WhiterShadePale1.jpg, вы, вероятно, увидите, что первый столбец -rwxrwxr-x, где x указывают разрешения на выполнение. Для получения дополнительной информации см. [D0] Как работают права доступа к файлам? – wjandrea 10 April 2018 в 23:02
  • 4
    @PaulBenson Если было неясно, для файла не требуется разрешение на выполнение, но это не проблема. – wjandrea 10 April 2018 в 23:26
  • 5
    Thnx. Теперь это яснее. – Paul Benson 10 April 2018 в 23:42

Другие вопросы по тегам:

Похожие вопросы: