Results 1 to 4 of 4

Thread: Color over SSH (not just in text editors)

  1. #1
    Join Date
    Jan 2014
    Beans
    6

    Unhappy Color over SSH (not just in text editors)

    Emacs is my editor of choice. Sue me. Over SSH, I see all the relevant colors in emacs. What I don't see is bright green for executable, light blue for symlink, dark blue for directory. How can I see those colors over SSH whether from Linux, xBSD, Mac, Windows (putty/kitty) or other? I currently see no colors when running ls over any of these SSH clients. Yes, my SSH clients support color. I told you guys that I see colors in emacs.

    No, ls --color or such thing is not what I want. I want to run ls with no extras, and see color from any SSH client that supports color.

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,746

    Re: Color over SSH (not just in text editors)

    Have a read of ~/.bashrc on your local PC. There is a lot of colour manipulation in there, deciding when to show colour or not.
    Also note this in "man ls":
    Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COL‐
    ORS environment variable can change the settings. Use the dircolors command to set it.
    I suspect that you never actually run ls with no extras.

  3. #3
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,853
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Color over SSH (not just in text editors)

    From ls' man page:
    Code:
           --color[=WHEN]
                  colorize  the output; WHEN can be 'always' (default if omitted),
                  'auto', or 'never'; more info below
    
    (...)
    
           Using  color  to distinguish file types is disabled both by default and
           with --color=never.  With --color=auto, ls emits color codes only  when
           standard  output is connected to a terminal.  The LS_COLORS environment
           variable can change the settings.  Use the dircolors command to set it.
    When you create your user during Ubuntu install, you get a number of aliases automatically:
    Code:
    $ alias
    (...)
    alias ls='ls --color=auto'
    So by default, ls runs with --color=auto, which will show colours when your use it directly on a terminal, but not when redirecting the output to a file, a pipe to a different tool or to ssh. You can change this by changing the alias, but then it will also use colours when writing to a file and there are tools that may be broken by such behaviour.

  4. #4
    Join Date
    May 2010
    Beans
    3,469

    Re: Color over SSH (not just in text editors)

    have you edited your ~/.bashrc file? If not then if you run
    Code:
    source ~/.bashrc
    Does it work OK?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •