I’m using a linux server that display directories in a bold font, and files in a normal font.
e.g. $ ls produces
afile.txt afolder anotherfile.txt anotherfolder
I’d like to use this feature on some other servers. How can it be done? with the .bash_profile?
If anyone has other ideas on how to differentiate folders from file, they’d be good to know?
You need to give
lsthe--colors=…option (e.g. via an alias). To actually configure theLS_COLORSenvironmental variable used to define the colours, one good way is to create a configuration file fordircolors, e.g. with just bold (attribute 1) directories:Then in your
.bash_profileor.bashrc,evalthe output ofdircolorsrun on that file to setLS_COLORSaccording to your configuration. The relevant lines in my.bashrc(copied from somewhere) look like this:Note that some terminals do not, by default, display the bold attribute as true bold but rather just use a brighter colour. You need to configure your terminal to get real bold.
See the
dircolors --print-databasefor an example of a “complete” configuration file.