Terminal - SSH as Root, No ANSI Colours

Discussion in 'Mac Apps and Mac App Store' started by kolax, Jun 30, 2012.

  1. kolax macrumors G3

    Mar 20, 2007
    Whenever I SSH as root to a server using Terminal, I don't get any ANSI colours being used. If I SSH as non-root, ANSI colours are displayed.

    Rather annoying as the ANSI colours make it much easier to see directories, files and executables.

    Any ideas why this is?
  2. soloer macrumors 6502a


    Sep 27, 2004
    Different shells maybe? Different variables set for whichever shell you're using? Alias set up for the 'ls' command?
  3. dakwar macrumors 6502

    Nov 2, 2010
    Its complicated. Here's a starter: http://net.tutsplus.com/tutorials/tools-and-tips/how-to-customize-your-command-prompt/

    A shorter version: The mac terminal logs each user into that user's preferred shell. Options are "bash", "tcsh", "zsh" etc. The default is "bash". For each one of those shells, there exists a ".bashrc", ".tcshrc", ".zshrc" etc. file that tells the shell how to behave. These ".{something}rc" files are unique to each user account. In your case, whatever shell your root and non-root accounts are using on the server when you SSH into that server, those shells have different ".{something}rc" files that tells the two accounts to behave differently. How to fix it is not trivial if you're not familiar with all that MAY be listed in the ".{something}rc files. The simplest option that might work for you is to alias "ls" to "ls -G" for example. The link above has a much more detailed explanation of how you can modify your shell's behaviour with colour.
  4. kolax thread starter macrumors G3

    Mar 20, 2007
    Does look a lot of effort!

    I checked that link out, and ended up getting iTerm along with the Solarised theme and the font he uses. Quite easy on the eye!

    I'll get round to colourising ls soon, wish there was a quick easy fix!

Share This Page