4

I am trying to make the terminal in Ubuntu server look and feel like the Ubuntu desktop terminal in terms of font and colour scheme. Is there a way to do this?

Zanna
  • 70,465
Baba.S
  • 139

2 Answers2

4

When you log in to a tty this is a login shell, so it sources, ~/.profile or if it exists, ~/.bash_login or if it exists, ~/.bash_profile (usually only ~/.profile exists in Ubuntu).

~/.bashrc is sourced by interactive non-login shells (terminals you open in a desktop environment)

Here are aliases present by default in Ubuntu (desktop) for colours in terminals:

alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

These are found in .bashrc If they are not present, you can add them there.

To get the same settings as .bashrc in a login shell (tty) you should make sure that .bash_profile or .bash_login or .profile is sourcing your .bashrc by putting something like this in your .bash_profile or .bash_login or .profile, if it is not already there:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

The font is a different matter:

sudo apt install fonts-ubuntu-font-family-console

Then add this line to the end of the same file (.bash_profile, .bash_login or, most likely, .profile)

setfont /usr/share/consolefonts/UbuntuMono-R-8x16.psf

To use it immediately, you can source .profile (or whichever file you put it in), otherwise, it will be changed on your next log in.

Zanna
  • 70,465
0

All style and color stuff is related to your shell configuration. In the case of bash (Ubuntu standard) it is a simple file called .bashrc in your home folder. Copy it to the according folder (home folder of the user you are on the server) on the server and after reloading the shell it should be the same provided you do not need to install any further packages. Other shells are similar to bash, zsh e.g. uses a .zshrc. In some cases you also have to copy more files if you did more advanced tweaks on your shells (e.g. .bash_aliases).

matt3o
  • 941