How do I add color and labels to bash when opened with alias command?

I have an alias command to connect to a computer using ssh.

Here is an example of my alias command:

alias yusuf-mongo-191='ssh '

I want to customize the terminal of this remote machine to use a colored label, so I can easily determine which terminal it is. It doesn't matter where the label is. I just want to see the label and have a special color for the remote machine.

0

1 Answer

You're looking at this the wrong way around: you need to make the change on the remote server, not on your local machine. Simply set your PS1 prompt to be a different color on the remote machine. Open your ~/.bashrc file on the remote, and change the PS1 variable so that it is different on that machine.

That way, you will always know what machine you are on. See here for details on how to configure your PS1 prompt:

Changing colors for user, host, directory information in terminal command prompt

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like