How to customize linux

Делаем Linux терминал красивым и удобным

Добавляем функциональность

Командная оболочка

Большинство дистрибутивов поставляется со встроенным Bash. Используя дополнения можно сделать из него все что захотите, но гораздо проще этого добиться с Zsh. Почему?

Настройка Zsh

Для начала, установим Zsh (если он уже установлен, например, как в Manjaro, можете пропустить этот пункт):

Когда вам предложат установить Zsh как оболочка по-умолчанию, нажмите Y , чтоб подтвердить.

Oh-My-Zsh — популярный и активно развивающийся фреймворк Zsh, который позволяет гибко настроить оболочку терминала. Установим его:

Подсветка синтаксиса. Гораздо проще ориентироваться по содержимому терминала, когда разные части команд подсвечены разными цветами. Например, директории будут подчеркиваться, а команды — выделяться цветом, отличным от обычного текста. Установим плагин zsh-syntax-highlighting :

Чтоб плагин заработал, его надо подключить.

/.zshrc меняем строку с plugins= :

Если такой строки нет — добавьте её.

Готово! Получаем удобный и функциональный терминал. Теперь сделаем его визуально приятным.

Настраиваем внешний вид

Скачиваем и добавляем в систему шрифт JetBrains Mono Nerd (c иконками):
Выберитеодин из списка, в папке шрифт/complete выберите шрифт без «Windows Compatible», с окончанием «Mono».

Подключаем шрифт и тему.

Если в файле эти строки уже есть — замените их.

Цвета. Важная часть оформления терминала — цветовая схема. Я перебрал много разных схем, редактировал их, остановился на Monokai Dark. Не режет глаза, но при этом приятная и яркая. Список цветов:

В разных терминалах по-разному меняется цветовая схема (обычно, это делается через настройки терминала), но порядок цветов везде одинаковый. Вы можете импортировать этот шаблон в формате Termite и экспортировать его для вашего терминала через terminal.sexy

Запускаем конфигурацию темы: p10k configure .
Настройте тему, выбирая варианты отображения, которые вам больше нравятся.

Финальный штрих — меняем конфиг темы и заменяем встроенные цвета.

Если в файле эти строки уже есть — замените их. Коды цветов можно получить командой

    Отображение только текущей директории:

Источник

5 Tweaks to Customize the Look of Your Linux Terminal

Last updated September 8, 2021 By Ankush Das 30 Comments

The terminal emulator or simply the terminal is an integral part of any Linux distribution.

When you change the theme of your distribution, often the terminal also gets a makeover automatically. But that doesn’t mean you cannot customize the terminal further.

In fact, many It’s FOSS readers have asked us how come the terminal in our screenshots or videos look so cool, what fonts do we use, etc.

To answer this frequent question, I’ll show you some simple and some complex tweaks to change the appearance of the terminal. You can compare the visual difference in the image below:

Читайте также:  Реестр операционной системы microsoft windows

Customizing Linux Terminal

This tutorial utilizes a GNOME terminal on Pop!_OS to customize and tweak the look of the terminal. But, most of the advice should be applicable to other terminals as well.

For most of the elements like color, transparency, and fonts, you can utilize the GUI to tweak it without requiring to enter any special commands.

Open your terminal. In the top right corner, look for the hamburger menu. In here, click on “Preferences” as shown in the screenshot below:

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?fit=300%2C131&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?fit=800%2C350&ssl=1″ loading=»lazy» width=»800″ height=»350″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=800%2C350&ssl=1″ alt=»Linux Terminal Preferences» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?w=800&ssl=1 800w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=300%2C131&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=768%2C336&ssl=1 768w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=100%2C44&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=150%2C66&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

This is where you’ll find all the settings to change the appearance of the terminal.

Tip 0: Use separate terminal profiles for your customization

I would advise you to create a new profile for your customization. Why? Because this way, your changes won’t impact the main terminal profile. Suppose you make some weird change and cannot recall the default value? Profiles help separate the customization.

As you can see, Abhishek has separate profiles for taking screenshots and making videos.

You can easily change the terminal profiles and open a new terminal window with the new profile.

Change Terminal Profile

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?fit=300%2C131&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?fit=796%2C347&ssl=1″ loading=»lazy» width=»796″ height=»347″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=796%2C347&ssl=1″ alt=»Change Terminal Profile» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?w=796&ssl=1 796w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=300%2C131&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=768%2C335&ssl=1 768w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=100%2C44&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=150%2C65&ssl=1 150w» sizes=»(max-width: 796px) 100vw, 796px» data-recalc-dims=»1″/> Change Terminal Profile

That was the suggestion I wanted to put forward. Now, let’s see those tweaks.

Tip 1: Use a dark/light terminal theme

You may change the system theme and the terminal theme gets changed. Apart from that, you may switch between the dark theme or light theme, if you do not want to change the system theme.

Once you head in to the preferences, you will notice the general options to change the theme and other settings.

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?fit=300%2C136&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?fit=800%2C363&ssl=1″ loading=»lazy» width=»800″ height=»363″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=800%2C363&ssl=1″ alt=»Terminal Theme» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?w=800&ssl=1 800w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=300%2C136&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=768%2C348&ssl=1 768w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=100%2C45&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=150%2C68&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

Tip 2: Change the font and size

Select the profile that you want to customize. Now you’ll get the option to customize the text appearance, font size, font style, spacing, cursor shape, and toggle the terminal bell sound as well.

For changing the terminal font, you can only change to what’s available on your system. If you want something different, download and install the font on your Linux system first.

One more thing! Use monospaced fonts otherwise fonts might overlap and the text may not be clearly readable. If you want suggestions, go with Share Tech Mono (open source) or Larabiefont (not open source).

Under the Text tab, select Custom font and then change the font and its size (if required).

» data-medium-file=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?fit=300%2C188&ssl=1″ data-large-file=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?fit=800%2C500&ssl=1″ loading=»lazy» width=»800″ height=»500″ src=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=800%2C500&ssl=1″ alt=»Terminal Customization 1″ srcset=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?w=800&ssl=1 800w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=300%2C188&ssl=1 300w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=768%2C480&ssl=1 768w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=100%2C63&ssl=1 100w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=150%2C94&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

Читайте также:  Как переустановить windows phoenix awards

Tip 3: Change the color pallet and transparency

Apart from the text and spacing, you can access the “Colors” tab and change the color of the text and background of your terminal. You can also adjust the transparency to make it look even cool.

As you can notice, you can change the color palette from a set of pre-configured options or tweak it yourself.

Terminal Color Customization

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?fit=300%2C240&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?fit=759%2C607&ssl=1″ loading=»lazy» width=»759″ height=»607″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=759%2C607&ssl=1″ alt=»Terminal Color Customization» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?w=759&ssl=1 759w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=300%2C240&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=100%2C80&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=150%2C120&ssl=1 150w» sizes=»(max-width: 759px) 100vw, 759px» data-recalc-dims=»1″/>

If you want to enable transparency just like I did, you click on “Use transparent background” option.

You can also choose to use colors from your system theme, if you want a similar color setting with your theme.

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?fit=300%2C214&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?fit=800%2C571&ssl=1″ loading=»lazy» width=»800″ height=»571″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=800%2C571&ssl=1″ alt=»Linux Terminal» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?w=800&ssl=1 800w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=300%2C214&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=768%2C548&ssl=1 768w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=100%2C71&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=150%2C107&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

Tip 4: Tweaking the bash prompt variables

Usually, you will see your username along with the hostname (your distribution) as the bash prompt when launching the terminal without any changes.

For instance, it would be “ankushdas@pop-os:

$” in my case. However, I permanently changed the hostname to “itsfoss“, so now it looks like:

» data-medium-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?fit=300%2C71&ssl=1″ data-large-file=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?fit=800%2C188&ssl=1″ loading=»lazy» width=»800″ height=»188″ src=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=800%2C188&ssl=1″ alt=»Itsfoss Hostname» srcset=»https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?w=800&ssl=1 800w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=300%2C71&ssl=1 300w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=768%2C180&ssl=1 768w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=100%2C24&ssl=1 100w, https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=150%2C35&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

To change the hostname, you can type in:

However, this will be applicable only for the current sessions. So, when you restart, it will revert to the default. To permanently change the hostname, you need to type in:

Similarly, you can also change your username, but it requires some additional configuration that includes killing all the current processes associated with the active username, so we’ll avoid it to change the look/feel of the terminal.

However, you can tweak the font and color of the bash prompt ([email protected]:

You will need to utilize the PS1 environment variable which controls what is being displayed as the prompt. You can learn more about it in the man page.

For instance, when you type in:

The output in my case is:

We need to focus on the first part of the output:

Here, you need to know the following:

  • \e is a special character that denotes the start of a color sequence
  • \u indicates the username followed by the @ symbol
  • \h denotes the hostname of the system
  • \w denotes the base directory
  • \a indicates the active directory
  • $ indicates non-root user

The output in your case can be different, but the variables will be the same, so you need to play with the commands mentioned below depending on your output.

Before you do that, keep these in mind:

  • Codes for text format: 0 for normal text, 1 for bold, 3 for italic and 4 for underline text
  • Color range for background colors: 40-47
  • Color range for text color: 30-37
Читайте также:  Выберите как устанавливать обновления windows 10

You just need to type in the following to change the color and font:

This is how your bash prompt will look like after typing the command:

» data-medium-file=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?fit=300%2C71&ssl=1″ data-large-file=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?fit=800%2C190&ssl=1″ loading=»lazy» width=»800″ height=»190″ src=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=800%2C190&ssl=1″ alt=»Terminal Bash Prompt Customization» srcset=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?w=800&ssl=1 800w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=300%2C71&ssl=1 300w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=768%2C182&ssl=1 768w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=100%2C24&ssl=1 100w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=150%2C36&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

If you notice the command properly, as mentioned above, \e helps us assign a color sequence.

In the command above, I’ve assigned a background color first, then the text style, and then the font color followed by “m“.

Here, “m” indicates the end of the color sequence.

So, all you have to do is, play around with this part:

Rest of the command should remain the same, you just need to assign different numbers to change the background color, text style, and text color.

Do note that this is in no particular order, you can assign the text style first, background color next, and the text color at the end as “3;41;32“, where the command becomes:

» data-medium-file=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?fit=300%2C59&ssl=1″ data-large-file=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?fit=800%2C158&ssl=1″ loading=»lazy» width=»800″ height=»158″ src=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=800%2C158&ssl=1″ alt=»Linux Terminal Customization 1s» srcset=»https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?w=800&ssl=1 800w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=300%2C59&ssl=1 300w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=768%2C152&ssl=1 768w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=100%2C20&ssl=1 100w, https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=150%2C30&ssl=1 150w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

As you can notice, the color customization is the same no matter the order. So, just keep in mind the codes for customization and play around with it till you’re sure you want this as a permanent change.

The above command that I mentioned temporarily customizes the bash prompt for the current session. If you close the session, you will lose the customization.

So, to make this a permanent change, you need to add it to .bashrc file (this is a configuration file that loads up every time you load up a session).

Bashrch Customization Terminal

» data-medium-file=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?fit=300%2C231&ssl=1″ data-large-file=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?fit=800%2C615&ssl=1″ loading=»lazy» width=»800″ height=»615″ src=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=800%2C615&ssl=1″ alt=»Bashrch Customization Terminal» srcset=»https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=800%2C615&ssl=1 800w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=300%2C231&ssl=1 300w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=768%2C591&ssl=1 768w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=100%2C77&ssl=1 100w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=150%2C115&ssl=1 150w, https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?w=805&ssl=1 805w» sizes=»(max-width: 800px) 100vw, 800px» data-recalc-dims=»1″/>

You can access the file by simply typing:

Unless you’re sure what you’re doing, do not change anything. And, just for the sake of restoring the settings back, you should keep a backup of the PS1 environment variable (copy-paste what’s in it by default) to a text file.

So, even if you need the default font and color, you can again edit the .bashrc file and paste the PS1 environment variable.

Bonus Tip: Change the terminal color pallet based on your wallpaper

If you want to change the background and text color of the terminal but you are not sure which colors to pick, you can use a Python-based tool Pywal. It automatically changes the color of the terminal based on your wallpaper or the image you provide to it.

I have written about it in details if you are interested in using this tool.

Источник

Оцените статью