Setting up a name in the terminal Linux

My question is pretty silly, but could not find nothing on the internet that explained me how. The thing is that I want to have the name displayed in the terminal as: Server mpi@raspberry: ... $ but can not find how to add the "name" Server to the user (I am calling that the name, but probably it is not correct). Instead, my terminal shows mpi@raspberry: ... $

Asked By: Enzo Basile

||

You can use this online tool to create a customized prompt:

https://bashrcgenerator.com/

You want the "hostname" to be displayed.

Answered By: kodcode

Explaining further the answer of kodcode:

In order to add an alias, we have to enter to each user and write sudo gedit ~/.bashrc, then we will see a lot of things written on this file, but the importante line to change is:

if [ "$color_prompt" = yes ]; then
    PS1='[33[1;33m]Alias ${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w $[33[00m] '
else
    PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
fi

Replace Alias by the alias that you want and copy the code to the file replacing in the original file from the beginning of the if, until fi. This will help to know at which device we are connecting to.

Answered By: Enzo Basile
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.