

With a number of machines, it might be useful in any case to search for solutions to synchronize configuration changes on all of them. Start your WSL shell (for me that is ubuntu.


Of course you could come up with some wrapper for the session to detect everything looking like a prompt and to colorize it, but it would easily lead to false positives (color on every line with a $?) and be awfully complicated compared to just dropping a single line to your. You could set colors before starting the session, but they'd be effective for all output, that is until an ls or an editor sets colors of it's own. Consider that on an SSH connection the local side has no real idea of what is a shell prompt and what is something else, and so setting colors for the prompt really has to come from the remote. If you don't want to (can't) make the remotes have a separate PS1, then I'd say "no", it would be at least awfully difficult. To check what the prompt would look like: echo -e "$ " Foot is not starting at all No colors in ls output Things break after I ssh into a remote machine I cant use the mouse to select text Emojis are black-and. Therefore, you should place the aliases from /etc/profile.d/.sh (or. \[033[48 5 XXXm\033[38 5 YYYm sets the background/foreground to XXX/ YYY.įor a script that dumps the available colors, try colortest. There is no colors in ls output under user but running ls as root gives color output. So here, :\w appear in terminal foreground/background. \[033[m resets foreground and background to default. In PS1, the escape codes must be enclosed in \.
#Ubuntu ssh shell ls no color code
If you want this code to run when logging into a remote server, you should have one of the profile files always source ~/.bashrc. (Arguably a more accurate test is checking if $- contains i.) Testing if PS1 is non-empty is a very common way to decide if the shell is interactive, and you don't want to confuse programs that do that. However, you can use a single ~/.bashrc for all hosts, and set the prompt color based on hostname: || return 0 # continue only when interactive So you still need to copy it to the remote server. The remote prompt is set by the remote ~/.bashrc.
