Sunday, May 12, 2024
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 1728  / 2 Years ago, sat, april 30, 2022, 4:58:40

How can I colorize hardlinks myself? Turns out on an old Ubuntu 10.04 I have, this happens by default (same .bashrc and .profile in use), whereas on the newer Ubuntu 12.04 it doesn't.



This is the output on Ubuntu 10.04 (the one I desire):



Having the colored output for hardlinked files



And this is the output on Ubuntu 12.04:
Missing the colored output for hardlinked files



The relevant file is .vimrc, however, .viminfo is an ordinary file with link count 1, in contrast to the hardlinked .vimrc.



Of course the fact that GNU coreutils uses texinfo pages instead of man pages doesn't make things easier. I found this here, but it doesn't refer to the case I am looking for.



TL;DR: how to achieve coloring hardlinked (as in: link count > 1) files the way I like in various Ubuntu versions.


More From » command-line

 Answers
7

Do this:



LS_COLORS="mh=44;37" ls -l


And you may edit your ~/.profile to change LS_COLORS accordingly.



Background



This feature was enabled as default in 2008 has been disabled by default in 2009. Somehow the freeze for Ubuntu 10.04 was exactly in between those moments.



Using the Git repository of coreutils I see that the commit to revert automatic colourization has been in since version 7.5:



git tag --contains 0df338f6719ec2bcf1e1dea2d8b12dc66daf8a1e
v7.5
v7.6
[...]


In versions before 7.1 there seems no upstream maintained support for this:



git tag --contains 1e48b1fee5fa2ad2d1802771eafbfcddb38a24cb
v7.1
v7.2
[...]


The source file multihardlink.sh, lead me to the exact LS_COLORS value to enable it again.



You may want to reopen LP Bug #123423.


[#32836] Monday, May 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
torlim

Total Points: 408
Total Questions: 113
Total Answers: 110

Location: Estonia
Member since Wed, May 27, 2020
4 Years ago
torlim questions
;