Installing and configuring KDE Konsole with Oh My Zsh in Kubuntu
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)
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.
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.
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.
# 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
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
Create Alias File
Follow the below steps to create a new alias file or edit the existing alias file.
- Execute the command
nano ~/.bash_aliases
in terminal. - Add the line
alias cls='clear'
to create a sample alias entry. - Save and exit
.bash_aliases
file - Edit .zshrc file by executing the command
nano ~/.zshrc
in terminal - Add the line,
source=~/.bash_aliases
at the top of.zshrc
file - Save and exit
.zshrc
file - Execute
source ~/.zshrc
in terminal to reload settings - Try executing the command “
cls
” in terminal, you would be able to clear the terminal. - Any changes to
.bash_aliases
requires the.zshrc
file to be re-loaded. Execute the commandsource ~/.zshrc
for those changes to be reflected immediately.
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 ./
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.
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.
Leave a comment