- Делаем Linux терминал красивым и удобным
- Добавляем функциональность
- Командная оболочка
- Настройка Zsh
- Настраиваем внешний вид
- Результат
- Источники
- How to Make Ubuntu Terminal Look like Kali Linux
- 1. Installing required packages
- Installing ZSH on Ubuntu
- Installing zshell plugins
- Installing fonts, qterminal and gnome-tweaks
- 2. Changing the default login shell
- 3. Customizing ubuntu zshell
- Step 1. Modifying the zshrc file
- Step 2. Downloading color schemes and themes
- Step 3. Changing Qterminal settings
- Customizing gnome terminal
- Conclusion
Делаем Linux терминал красивым и удобным
Все дистрибутивы Linux поставляются с функциональным и кастомизируемым эмулятором терминала. В интернете, а порой даже в самом терминале, есть масса готовых тем, чтоб он красиво выглядел. Однако, чтоб сделать из стандартного терминала (в любом DE, любого дистрибутива) нечто красивое и одновременно удобное и простое в использовании я потратил много времени. Итак, как же сделать дефолтный терминал удобным и приятным в использовании?
Добавляем функциональность
Командная оболочка
Большинство дистрибутивов поставляется со встроенным Bash. Используя дополнения можно сделать из него все что захотите, но гораздо проще этого добиться с Zsh. Почему?
- Продвинутая механика автодополнения команд по нажатию или . В отличие от Bash, вам не нужно это настраивать, все работает на высшем уровне прямо «из коробки».
- Множество готовых тем, модулей, плагинов и прочего. Настраиваемость через фреймворки (oh-my-zsh, prezto и др.), которые значительно расширяют возможности кастомизации и улучшения терминала. Опять же, всего этого можно добиться и в Bash, но для Zsh масса уже готовых материалов. Для Bash их значительно меньше, а некоторых вовсе нет.
Настройка Zsh
Для начала, установим Zsh (если он уже установлен, например, как в Manjaro, можете пропустить этот пункт):
Когда вам предложат установить Zsh как оболочка по-умолчанию, нажмите Y , чтоб подтвердить.
Oh-My-Zsh — популярный и активно развивающийся фреймворк Zsh, который позволяет гибко настроить оболочку терминала. Установим его:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Подсветка синтаксиса. Гораздо проще ориентироваться по содержимому терминала, когда разные части команд подсвечены разными цветами. Например, директории будут подчеркиваться, а команды — выделяться цветом, отличным от обычного текста. Установим плагин zsh-syntax-highlighting :
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
Чтоб плагин заработал, его надо подключить.
В файле ~/.zshrc меняем строку с plugins= :
plugins=(git zsh-syntax-highlighting)
Если такой строки нет — добавьте её.
Готово! Получаем удобный и функциональный терминал. Теперь сделаем его визуально приятным.
Настраиваем внешний вид
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
Скачиваем и добавляем в систему шрифт JetBrains Mono Nerd (c иконками):
Выберитеодин из списка, в папке шрифт/complete выберите шрифт без «Windows Compatible», с окончанием «Mono».
Если в файле эти строки уже есть — замените их.
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_MODE="nerdfont-complete"
[colors] # special foreground = #e6e6e6 foreground_bold = #e6e6e6 cursor = #fff background = #000 # black color0 = #75715e color8 = #272822 # red color1 = #f92672 color9 = #f92672 # green color2 = #a6e22e color10 = #a6e22e # yellow color3 = #434648 color11 = #7ea35f # blue color4 = #66d9ef color12 = #66d9ef # magenta color5 = #ae81ff color13 = #ae81ff # cyan color6 = #adb3b9 color14 = #62ab9d # white color7 = #2AA198 color15 = #2AA198
В разных терминалах по-разному меняется цветовая схема (обычно, это делается через настройки терминала), но порядок цветов везде одинаковый. Вы можете импортировать этот шаблон в формате Termite и экспортировать его для вашего терминала через terminal.sexy
Запускаем конфигурацию темы: p10k configure .
Настройте тему, выбирая варианты отображения, которые вам больше нравятся.
Финальный штрих — меняем конфиг темы и заменяем встроенные цвета.
Если в файле эти строки уже есть — замените их. Коды цветов можно получить командой
for i in ; do print -Pn \"%K %k%F$%f \" $:+$'\n'>; done
- Отображение только текущей директории:
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
typeset -g POWERLEVEL9K_DIR_BACKGROUND=33
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK__FOREGROUND=2
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR__FOREGROUND=1
typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=15
Результат
Ошибка:
GIT:
Источники
How to Make Ubuntu Terminal Look like Kali Linux
Kali Linux and Ubuntu are the two most popular Linux distributions. Ubuntu is a general-purpose Linux distribution that is popular among developers and students, though it is not limited to these groups, whereas Kali Linux is popular in the world of cybersecurity and ethical hacking.
There are a few visual differences between the Ubuntu terminal and the Kali Linux terminal. While the default Ubuntu terminal is functional, sometimes Ubuntu users may prefer the look of the Kali Linux terminal. In this guide, we learn how to make your Ubuntu terminal look like Kali Linux terminal.
1. Installing required packages
The first step in making your Ubuntu terminal look like Kali’s is to install zsh shell, zshell plugins and some additional tools if not already pre-installed
Installing ZSH on Ubuntu
The Z shell is a Unix shell that was developed as an extension to BASH (Bourne shell) in the early 90s. Z shell is an interactive shell that incorporates many features of other Unix/GNU Linux shells like bash, fish, dash and ksh.
It also has a powerful scripting language, just like the other shells. Despite this, it has some distinguishing characteristics, which include:
- Autocomplete for command names
- spelling corrections.
- Extensible via plugins.
- running shells can share the same history.
- supports several compatibility modes.
- Better variable and array handling.
- support themes
- Create filenames based on the conditions you provide.
Before installing z shell, you must first update your system by running the following command:
After successfully updating your system, run the following command to install zshell.
Once zsh has been installed, simply run the zsh command to switch from the bash prompt to the zsh prompt. When you run the command, you will see a z shell configuration prompt (select option zero from the prompt and hit enter to apply)
Installing zshell plugins
Next, we’ll need to install a few z shell plugins to add some useful functionality to our z shell. Here are the three plugins that will be installed.
- zsh-syntax-highlighting — This plugin highlights syntax in the z shell. It allows command highlighting when typing at a z shell prompt. This is useful for reviewing commands before running them, notably in spotting syntax errors.
- zsh-autosuggestions — this plugin suggests commands to you as you enter them based on your previous commands and completions.
Open your Ubuntu terminal and type the following command:
sudo apt install zsh-syntax-highlighting zsh-autosuggestions
This command will download and install all of the z shell plugins listed.
Installing fonts, qterminal and gnome-tweaks
The last things you need to install are:
- qterminal — a lightweight Qt terminal emulator based on QTermWidget, by default Ubuntu uses gnome terminal.
- fonts-firacode — a free monospaced font with ligatures for common multi-character programming combinations.
- gnome-tweaks — this is a must-have tool for any GNOME user. It allows you to customize the appearance and functionality of your desktop.
To install all these run the following command:
sudo apt install qterminal fonts-firacode gnome-tweaks
2. Changing the default login shell
Now that you’ve installed z shell and its plugins, you’ll need to make it your default login shell. To accomplish so, we’ll use the chsh (change shell) command. chsh is a powerful tool used to change a login shell. There is no need to install the chsh command because it is a standard package that comes pre-installed on all Linux distributions.
Run the following command to change your default login shell to z shell:
Please keep in mind that this command will permanently change your default login shell to the one you specify.
Before you can make any changes, you must first enter your username password. Log out and then back in to see the changes; the bash prompt will be replaced with the zsh prompt.
3. Customizing ubuntu zshell
Now that you’ve installed all of the tools needed to customize your Ubuntu terminal. It’s time to start customizing your Ubuntu terminal. Follow these steps to accomplish it.
Step 1. Modifying the zshrc file
You need to tweak the zshrc file in order to customize it’s appearance. This file is a hidden file in your home directory (~/.zshrc). The .zshrc file is a startup file equivalent for bashrc file for bash (Bourne Again shell) that is used to customize and configure the z shell.
This file may not be available at times, so you must create it; if it is already available, delete it and create a new one because you will need to override its contents.
To delete the file run the following command:
and to create a new file simply run this command:
After you have successfully created the .zshrc file, open it with your preferred text editor, copy and paste the contents of this pastebin into your .zshrc file, and save.
To make the changes take effect, source your .zshrc file with the source or dot (.) command, or simply close and reopen your terminal.
Step 2. Downloading color schemes and themes
Next clone the compressed kali linux color schemes and themes from. To do so run this command:
git clone https://github.com/linuxopsys/ubuntu-to-kali-terminal.git
Once the repository has been cloned, cd into it.
Next, extract the compressed files, once you have extracted all the files you will notice a new directory name «usr» in your current working directory.
tar -xvf color-schemes.tar tar -xvf kali-dark-theme.tar
You must now remove the qtermwidget5 directory located in the /usr/share directory and replace it with one from the extracted tar file.
sudo rm -rf /usr/share/qtermwidget5 sudo mv -f usr/share/qtermwidget5 /usr/share
Step 3. Changing Qterminal settings
Open your Qterminal preferences: Change the color scheme to Kali-Dark and then press the Apply button, this will change the terminal theme to that one of Kali. Also, at the bottom of your terminal’s Appearance settings, adjust the «Application transparency» from «0%» to «5%,» the same as on Kali, and click apply for the changes to take effect.
After you’ve made the changes, your qterminal should look like this:
All that remains is to change your entire system theme, which can be accomplished by moving the Kali-Dark directory from the directory you previously extracted to /usr/share/themes directory.
sudo mv -f usr/share/themes/Kali-Dark /usr/share/themes
To apply the theme, open gnome-tweaks by running the following command:
From the gnome-tweaks window, you will see various options for tweaking your system. Go to appearance and look for «Legacy Applications,» then change your theme to Kali-Dark.
This is how your qterminal should look after switching to the Kali-Dark theme:
Customizing gnome terminal
If you are not satisfied with the appearance of qterminal after customizing it, you can customize the gnome terminal that comes with Ubuntu. To do this customization, you must first install the following tools:
- dconf-cli — DConf is a low-level key/value database that is used to store desktop environment settings. This package includes the command-line tools required to configure and modify the database.
- uuid-runtime — This package contains tools for generating and parsing 128-bit Universally Unique Identifiers (UUIDs) (UUIDs).
- curl — command-line utility for transferring data over various network protocols.
sudo apt install dconf-cli uuid-runtime curl
After the packages have been installed run the following command to install the «Kali Dark» color scheme:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/linuxopsys/ubuntu-to-kali-terminal/main/gnome-themes/Kali-Dark.sh)"
To change your terminal theme right click on your terminal window and choose the «Kali-Dark» profile:
Remember that the system theme should also be «Kali-Dark», and that you can change it with gnome tweaks.
Conclusion
This is enough to make your Ubuntu terminal look the same as Kali, however if you need to do some additional configuration to improve your personal experience you might need to install oh my zsh. You can find oh my zsh installation procedure on its official website.
The ability to customize Linux operating systems is the primary advantage over other operating systems. Because it is an open-source operating system, you can customize any feature, add or remove any feature based on your needs and personal experience.
If this resource helped you, let us know your care by a Thanks Tweet. Tweet a thanks