Installing and configuring KDE Konsole with Oh My Zsh in Kubuntu

Ashok Raja T
Technology Specialist
July 26, 2021
Rate this article
Views    19220

Apart from installing zsh and enabling Oh My Zsh in KDE Konsole for Kubuntu, in this article, let us see how to set a different zsh theme for the root user, share alias commands, set background image, font, and other settings in KDE Konsole.

Install Zsh

If you have already installed Zsh, you can skip this section. Else, execute the below command in the terminal to install zsh in Kubuntu

# Install Zsh
sudo apt install zsh

# Change the Shell
chsh -s $(which zsh)
Log out and log in back for the new Shell to be assigned for the user.

After logging in back, open the Konsole and you would be greeted with a message similar to the one below. Select Option 2 to perform the initial auto-configuration. If you are not able to see this message in your terminal, execute the command echo $SHELL in the terminal and ensure that the output is pointing to the install location of zsh. If the Shell is still pointing to bash, you may have to repeat the previous installation step.

welcome msg

Install Oh My Zsh

Git and curl are pre-requisites to install Oh My Zsh. In Kubuntu, Curl would be available by default. To install Git, execute the command “sudo apt install git” in Terminal, followed by

# Install Git, if it is not already installed
sudo apt install git

# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

On successful, installation, you can expect a welcome message similar to this.

oh my zsh

Root Account

Although we have installed the Zsh for the logged-in user, the Shell of the root account would still point to bash. To change the Shell for the root account, execute the below commands in the terminal.

shell user as root

# Switch to root user
sudo -i

# Change the Shell
chsh -s $(which zsh)

Close the terminal and open it back. Execute the below commands to install Oh My Zsh for the root user

# Switch to root user
sudo -i

# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Change Zsh Theme

If you look at the below image, with the default settings, it would be difficult to visually differentiate the terminal of regular user and root user. To avoid this confusion, the easy option is to have two different themes or assign a theme that displays the username as part of the prompt.

Default Theme
Default Zsh Theme

sudo -i
nano .zshrc
# Change the default theme by replacing 
# the line, ZSH_THEME="robbyrussell" with below line
ZSH_THEME="half-life"

Save and exit the file. To reload all settings, execute the command source .zshrc in terminal.
Screen shots of all themes that are installed as part of Oh My Zsh can be found here.

Different Theme
zsh new theme

Create Alias File

Follow the below steps to create a new alias file or edit the existing alias file.

  1. Execute the command nano ~/.bash_aliases in terminal.
  2. Add the line alias cls='clear' to create a sample alias entry.
  3. Save and exit .bash_aliases file
  4. Edit .zshrc file by executing the command nano ~/.zshrc in terminal
  5. Add the line, source=~/.bash_aliases at the top of .zshrc file
  6. Save and exit .zshrc file
  7. Execute source ~/.zshrc in terminal to reload settings
  8. Try executing the command “cls” in terminal, you would be able to clear the terminal.
  9. Any changes to .bash_aliases requires the .zshrc file to be re-loaded. Execute the command source ~/.zshrc for those changes to be reflected immediately.
Refer this link to set alias for Changing Directory and other common operations. Check out my other article on Sharing iPhone screen in Linux to learn about alias for custom apps and adding location to PATH variable

Share Alias File With Root Account

To share the alias file with the root account, execute the below commands in the terminal.

sudo -i
# Replace "ar" with your user name
ln -s /home/ar/.bash_aliases ./
Repeat steps 4 to 9 from the Create Alias File section above.

By this approach, we are creating a symlink to the .bash_aliases file of the regular user. This allows us to re-use the same file with the root user account instead of managing a separate file for the root account.

This approach is not advisable if the system is shared with multiple users (accounts), as this may also lead to sharing sensitive information with others.

Background Image, Font & Other Settings

UI changes can be performed by creating a new Konsole profile or by modifying the default profile. To edit the default/current profile, select “Edit Current Profile” from the Settings menu of Konsole and navigate to Appearance Tab.

  • Color scheme can be changed by selecting any theme from Color scheme & font tab.
  • The default font size is 13, click the Choose button to change the font face and font size
  • If you do not like the default box cursor, select the “Cursor” tab to change it to “I-Beam” or “Underline”. You can also enable the blinking effect by selecting the “Blinking” option
  • Scroll bars can be removed by setting the “Scrollbar position” to “Hidden” in “Scrolling” section. ( Requires closing and opening Konsole)

To set a background image for KDE Konsole, click the Edit button in the “Color scheme & font” tab of the Appearance Section. Then click the image button near “Background image” textbox to select a image file. Refer the below image for sequence of steps.

change shell background

Konsole With Custom Background Image

zsh background

The menu bar and title bar can also be hidden by changing the settings under Settings => Configure Console => Process and window.

Subscribe To Our Newsletter
Loading

Leave a comment