Customizing Your Ubuntu Terminal: Tips and Tricks

Alexander Obregon
3 min readJun 29, 2023

--

Image Source

Introduction

The Ubuntu terminal, like any other Linux terminal, is a command-line interface that gives you control over your entire system. Yet, many users shy away from using it because of its intimidating default appearance. However, with a bit of tweaking and some cool tips and tricks, you can customize your Ubuntu terminal to make it visually appealing and more efficient.

Changing The Terminal’s Look

One of the simplest ways to change your Ubuntu terminal’s look and feel is by customizing the colors and font style.

1. Changing Colors

You can customize your terminal colors by going to Edit > Profile Preferences > Colors. Here, you can choose the text and background colors.

2. Customizing Fonts

To change the font, go to Edit > Profile Preferences > General. You can select the font and size that best fits your style.

Customizing Bash Prompt

The bash prompt is the short text at the start of the command line. It’s customizable and can provide useful information. You can modify it by changing the PS1 (Prompt String 1) environment variable in your .bashrc file.

Here’s a simple example that displays the current directory and a smiley face:

PS1='\w :) '

Now, when you open your terminal, you’ll see the current working directory followed by a smiley face.

Bash Aliases

Aliases in bash are shortcuts or abbreviations to a command or group of commands. They can save a lot of typing and make your work more efficient.

You can create an alias using the following syntax:

alias alias_name='command'

For instance, if you frequently navigate to a particular directory, you can create an alias for it:

alias docs='cd ~/Documents'

You can add these alias commands to your .bashrc or .bash_aliases file to make them permanent.

Adding Functionality With Bash Scripts

You can use bash scripts to add complex functionalities to your terminal. Let’s say we want to create a script that updates the system and cleans up afterward. We’ll create a script named sys_update.sh:

#!/bin/bash
echo "Updating system..."
sudo apt-get update && sudo apt-get upgrade -y
echo "Cleaning up..."
sudo apt-get autoremove -y && sudo apt-get clean
echo "System updated and cleaned."

Don’t forget to make the script executable with chmod +x sys_update.sh. Now, you can update your system just by running ./sys_update.sh.

Installing A New Shell: Zsh and Oh My Zsh

If you’re looking for an entirely different experience, you can replace bash with a different shell like Zsh. Zsh includes many features like spelling correction, cd shortcut, better theme support, and more.

sudo apt install zsh
chsh -s $(which zsh)

To make Zsh even better, you can install Oh My Zsh, an open-source, community-driven framework for managing your Zsh configuration. It comes with a lot of features out of the box.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Remember, changing your shell will significantly alter how your terminal works, so ensure you understand the changes before making them.

Terminal Multiplexing: Tmux

Tmux is a terminal multiplexer. It allows you to run multiple terminal instances in one window. It’s beneficial for running multiple commands simultaneously, remote work, and system recovery.

You can install Tmux using:

sudo apt install tmux

To start a new session, just type tmux. You'll see a green bar at the bottom indicating that you are in a Tmux session.

Conclusion

Remember, these are just a few of the many ways to customize your Ubuntu terminal. The flexibility and power of the Linux terminal are what make it such a strong tool. With a bit of time and patience, you can create a terminal experience that’s tailored to your needs and preferences. Happy customizing!

  1. Ubuntu Documentation
  2. GNOME Terminal Documentation
  3. Oh My Zsh
Image Source

--

--

Alexander Obregon

Software Engineer, fervent coder & writer. Devoted to learning & assisting others. Connect on LinkedIn: https://www.linkedin.com/in/alexander-obregon-97849b229/