12

I have been exploring files in bash, and in /etc/ssl/certs, most of the filenames are light blue. There is a red filename though, and I can't figure out why it is red.

Most of the files in this directory are .pem files. The red one is also a .pem file. It happens to be something like China_Internet_Network_Information_Center...pem

According to this stack exchange question , light blue filenames mean linked files, while red file names mean "archived" files. What does that mean? Looking at the directory with ls -all, I still can't tell what makes the filename red. Can anyone explain why it is red?

jabe
  • 233
  • 3
    sounds like ls is coloring the files based on certain criteria; it might be helpful to include the ls -al output. My suspicion is a broken symlink. – Jeff Schaller Feb 17 '17 at 18:23
  • 1
    also, the result of echo $LS_COLORS – Jeff Schaller Feb 17 '17 at 18:25
  • 3
    By the way, there is no such ls option as -all.  There is a -a (all) option and a -l (long) option.  When you say ls -all, you are specifying the -a option once and the -l option twice (which does no good). You might as well just say ls -al. (Or ls -la, or ls -a -l or ls -l -a, all of which are equivalent.) – G-Man Says 'Reinstate Monica' Feb 17 '17 at 20:49
  • 1
    My guess would be a broken link, as the file is in a directory with other links. ls -lah the file to confirm. – Boris the Spider Feb 18 '17 at 09:31
  • you can edit /etc/profile.d/colorls.sh and change auto to none at the bottom of the file where it does the alias of ls. I never liked any of that color highlighting. alias l='ls -FC' ftw! – ron Feb 01 '23 at 14:18

2 Answers2

25

First you need to know the VT100 color code

https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

I don't know what your text actually looks like, but "red text" is 31.

Then you want to look at the dircolors command, and find everything that has a 31 in it. In my case, that would be:

or=40;31;01
*.tar=01;31
*.tgz=01;31
*.arj=01;31
*.taz=01;31
*.lzh=01;31
*.lzma=01;31
*.tlz=01;31
*.txz=01;31
*.zip=01;31
*.z=01;31
*.Z=01;31
*.dz=01;31
*.gz=01;31
*.lz=01;31
*.xz=01;31
*.bz2=01;31
*.bz=01;31
*.tbz=01;31
*.tbz2=01;31
*.tz=01;31
*.deb=01;31
*.rpm=01;31
*.jar=01;31
*.rar=01;31
*.ace=01;31
*.zoo=01;31
*.cpio=01;31
*.7z=01;31
*.rz=01;31

Then you can go here

http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors

which tells you

  • or is an "orphan", a symbolic link with no target
  • the rest are file globs that match assorted archive and compression schemes

.pem doesn't appear on my list, and .pem files aren't colored on my system, so I can't help you further than that. But I'd guess "orphan".

hymie
  • 1,710
12

Most Linux distros by default usually color-code files so you can immediately recognize what type they are. You are right that red means archive file and .pem is an archive file. An archive file is just a file composed of other files. Examples you might be more familiar with might include .zip, .rar, or .tar files.

If you want to know more about .pem files this post has a good explanation

ProdIssue
  • 875
  • 3
    Linux is the kernel, and has no concept of color codes for file names. You are talking about the default bash (or another shell) configuration included in the distribution. – phihag Feb 17 '17 at 22:29
  • 2
    @phihag: It's probably not whatever shell you're using, but (as mentioned above) specific to the ls command. You can use the option --color=never to turn colorization off (my choice), or the dircolors command to set it to whatever you prefer. – jamesqf Feb 18 '17 at 00:50
  • Archive? Only context I know of pem is with cryptographic keys. Is it even allowed to contain arbitrary data? – jpmc26 Feb 18 '17 at 01:16
  • @jpmc26 it contains multiple certificates in one .pem so it is considered an archive file. – ProdIssue Feb 18 '17 at 13:29
  • The weird thing is, is that the vast majority of the .pem files there are light blue. I suspect it is a broken link. – jabe Feb 18 '17 at 18:53